grammar.c 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665
  1. /* A Bison parser, made by GNU Bison 3.0.4. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* As a special exception, you may create a larger work that contains
  15. part or all of the Bison parser skeleton and distribute that work
  16. under terms of your choice, so long as that work isn't itself a
  17. parser generator using the skeleton or a modified version thereof
  18. as a parser skeleton. Alternatively, if you modify or redistribute
  19. the parser skeleton itself, you may (at your option) remove this
  20. special exception, which will cause the skeleton and the resulting
  21. Bison output files to be licensed under the GNU General Public
  22. License without this special exception.
  23. This special exception was added by the Free Software Foundation in
  24. version 2.2 of Bison. */
  25. /* C LALR(1) parser skeleton written by Richard Stallman, by
  26. simplifying the original so-called "semantic" parser. */
  27. /* All symbols defined below should begin with yy or YY, to avoid
  28. infringing on user name space. This should be done even for local
  29. variables, as they might otherwise be expanded by user macros.
  30. There are some unavoidable exceptions within include files to
  31. define necessary library symbols; they are noted "INFRINGES ON
  32. USER NAME SPACE" below. */
  33. /* Identify Bison output. */
  34. #define YYBISON 1
  35. /* Bison version. */
  36. #define YYBISON_VERSION "3.0.4"
  37. /* Skeleton name. */
  38. #define YYSKELETON_NAME "yacc.c"
  39. /* Pure parsers. */
  40. #define YYPURE 1
  41. /* Push parsers. */
  42. #define YYPUSH 0
  43. /* Pull parsers. */
  44. #define YYPULL 1
  45. /* Substitute the variable and function names. */
  46. #define yyparse pcap_parse
  47. #define yylex pcap_lex
  48. #define yyerror pcap_error
  49. #define yydebug pcap_debug
  50. #define yynerrs pcap_nerrs
  51. /* Copy the first part of user declarations. */
  52. #line 26 "grammar.y" /* yacc.c:339 */
  53. /*
  54. * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
  55. * The Regents of the University of California. All rights reserved.
  56. *
  57. * Redistribution and use in source and binary forms, with or without
  58. * modification, are permitted provided that: (1) source code distributions
  59. * retain the above copyright notice and this paragraph in its entirety, (2)
  60. * distributions including binary code include the above copyright notice and
  61. * this paragraph in its entirety in the documentation or other materials
  62. * provided with the distribution, and (3) all advertising materials mentioning
  63. * features or use of this software display the following acknowledgement:
  64. * ``This product includes software developed by the University of California,
  65. * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  66. * the University nor the names of its contributors may be used to endorse
  67. * or promote products derived from this software without specific prior
  68. * written permission.
  69. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  70. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  71. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  72. *
  73. */
  74. #ifdef HAVE_CONFIG_H
  75. #include <config.h>
  76. #endif
  77. #include <stdlib.h>
  78. #ifndef _WIN32
  79. #include <sys/types.h>
  80. #include <sys/socket.h>
  81. #if __STDC__
  82. struct mbuf;
  83. struct rtentry;
  84. #endif
  85. #include <netinet/in.h>
  86. #include <arpa/inet.h>
  87. #endif /* _WIN32 */
  88. #include <stdio.h>
  89. #include "diag-control.h"
  90. #include "pcap-int.h"
  91. #include "gencode.h"
  92. #include "grammar.h"
  93. #include "scanner.h"
  94. #ifdef HAVE_NET_PFVAR_H
  95. #include <net/if.h>
  96. #include <net/pfvar.h>
  97. #include <net/if_pflog.h>
  98. #endif
  99. #include "llc.h"
  100. #include "ieee80211.h"
  101. #include <pcap/namedb.h>
  102. #ifdef HAVE_OS_PROTO_H
  103. #include "os-proto.h"
  104. #endif
  105. #ifdef YYBYACC
  106. /*
  107. * Both Berkeley YACC and Bison define yydebug (under whatever name
  108. * it has) as a global, but Bison does so only if YYDEBUG is defined.
  109. * Berkeley YACC define it even if YYDEBUG isn't defined; declare it
  110. * here to suppress a warning.
  111. */
  112. #if !defined(YYDEBUG)
  113. extern int yydebug;
  114. #endif
  115. /*
  116. * In Berkeley YACC, yynerrs (under whatever name it has) is global,
  117. * even if it's building a reentrant parser. In Bison, it's local
  118. * in reentrant parsers.
  119. *
  120. * Declare it to squelch a warning.
  121. */
  122. extern int yynerrs;
  123. #endif
  124. #define QSET(q, p, d, a) (q).proto = (unsigned char)(p),\
  125. (q).dir = (unsigned char)(d),\
  126. (q).addr = (unsigned char)(a)
  127. struct tok {
  128. int v; /* value */
  129. const char *s; /* string */
  130. };
  131. static const struct tok ieee80211_types[] = {
  132. { IEEE80211_FC0_TYPE_DATA, "data" },
  133. { IEEE80211_FC0_TYPE_MGT, "mgt" },
  134. { IEEE80211_FC0_TYPE_MGT, "management" },
  135. { IEEE80211_FC0_TYPE_CTL, "ctl" },
  136. { IEEE80211_FC0_TYPE_CTL, "control" },
  137. { 0, NULL }
  138. };
  139. static const struct tok ieee80211_mgt_subtypes[] = {
  140. { IEEE80211_FC0_SUBTYPE_ASSOC_REQ, "assocreq" },
  141. { IEEE80211_FC0_SUBTYPE_ASSOC_REQ, "assoc-req" },
  142. { IEEE80211_FC0_SUBTYPE_ASSOC_RESP, "assocresp" },
  143. { IEEE80211_FC0_SUBTYPE_ASSOC_RESP, "assoc-resp" },
  144. { IEEE80211_FC0_SUBTYPE_REASSOC_REQ, "reassocreq" },
  145. { IEEE80211_FC0_SUBTYPE_REASSOC_REQ, "reassoc-req" },
  146. { IEEE80211_FC0_SUBTYPE_REASSOC_RESP, "reassocresp" },
  147. { IEEE80211_FC0_SUBTYPE_REASSOC_RESP, "reassoc-resp" },
  148. { IEEE80211_FC0_SUBTYPE_PROBE_REQ, "probereq" },
  149. { IEEE80211_FC0_SUBTYPE_PROBE_REQ, "probe-req" },
  150. { IEEE80211_FC0_SUBTYPE_PROBE_RESP, "proberesp" },
  151. { IEEE80211_FC0_SUBTYPE_PROBE_RESP, "probe-resp" },
  152. { IEEE80211_FC0_SUBTYPE_BEACON, "beacon" },
  153. { IEEE80211_FC0_SUBTYPE_ATIM, "atim" },
  154. { IEEE80211_FC0_SUBTYPE_DISASSOC, "disassoc" },
  155. { IEEE80211_FC0_SUBTYPE_DISASSOC, "disassociation" },
  156. { IEEE80211_FC0_SUBTYPE_AUTH, "auth" },
  157. { IEEE80211_FC0_SUBTYPE_AUTH, "authentication" },
  158. { IEEE80211_FC0_SUBTYPE_DEAUTH, "deauth" },
  159. { IEEE80211_FC0_SUBTYPE_DEAUTH, "deauthentication" },
  160. { 0, NULL }
  161. };
  162. static const struct tok ieee80211_ctl_subtypes[] = {
  163. { IEEE80211_FC0_SUBTYPE_PS_POLL, "ps-poll" },
  164. { IEEE80211_FC0_SUBTYPE_RTS, "rts" },
  165. { IEEE80211_FC0_SUBTYPE_CTS, "cts" },
  166. { IEEE80211_FC0_SUBTYPE_ACK, "ack" },
  167. { IEEE80211_FC0_SUBTYPE_CF_END, "cf-end" },
  168. { IEEE80211_FC0_SUBTYPE_CF_END_ACK, "cf-end-ack" },
  169. { 0, NULL }
  170. };
  171. static const struct tok ieee80211_data_subtypes[] = {
  172. { IEEE80211_FC0_SUBTYPE_DATA, "data" },
  173. { IEEE80211_FC0_SUBTYPE_CF_ACK, "data-cf-ack" },
  174. { IEEE80211_FC0_SUBTYPE_CF_POLL, "data-cf-poll" },
  175. { IEEE80211_FC0_SUBTYPE_CF_ACPL, "data-cf-ack-poll" },
  176. { IEEE80211_FC0_SUBTYPE_NODATA, "null" },
  177. { IEEE80211_FC0_SUBTYPE_NODATA_CF_ACK, "cf-ack" },
  178. { IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL, "cf-poll" },
  179. { IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "cf-ack-poll" },
  180. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_DATA, "qos-data" },
  181. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_ACK, "qos-data-cf-ack" },
  182. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_POLL, "qos-data-cf-poll" },
  183. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_CF_ACPL, "qos-data-cf-ack-poll" },
  184. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA, "qos" },
  185. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_POLL, "qos-cf-poll" },
  186. { IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_SUBTYPE_NODATA_CF_ACPL, "qos-cf-ack-poll" },
  187. { 0, NULL }
  188. };
  189. static const struct tok llc_s_subtypes[] = {
  190. { LLC_RR, "rr" },
  191. { LLC_RNR, "rnr" },
  192. { LLC_REJ, "rej" },
  193. { 0, NULL }
  194. };
  195. static const struct tok llc_u_subtypes[] = {
  196. { LLC_UI, "ui" },
  197. { LLC_UA, "ua" },
  198. { LLC_DISC, "disc" },
  199. { LLC_DM, "dm" },
  200. { LLC_SABME, "sabme" },
  201. { LLC_TEST, "test" },
  202. { LLC_XID, "xid" },
  203. { LLC_FRMR, "frmr" },
  204. { 0, NULL }
  205. };
  206. struct type2tok {
  207. int type;
  208. const struct tok *tok;
  209. };
  210. static const struct type2tok ieee80211_type_subtypes[] = {
  211. { IEEE80211_FC0_TYPE_MGT, ieee80211_mgt_subtypes },
  212. { IEEE80211_FC0_TYPE_CTL, ieee80211_ctl_subtypes },
  213. { IEEE80211_FC0_TYPE_DATA, ieee80211_data_subtypes },
  214. { 0, NULL }
  215. };
  216. static int
  217. str2tok(const char *str, const struct tok *toks)
  218. {
  219. int i;
  220. for (i = 0; toks[i].s != NULL; i++) {
  221. if (pcap_strcasecmp(toks[i].s, str) == 0)
  222. return (toks[i].v);
  223. }
  224. return (-1);
  225. }
  226. static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
  227. static PCAP_NORETURN_DEF void
  228. yyerror(void *yyscanner _U_, compiler_state_t *cstate, const char *msg)
  229. {
  230. bpf_syntax_error(cstate, msg);
  231. /* NOTREACHED */
  232. }
  233. #ifdef HAVE_NET_PFVAR_H
  234. static int
  235. pfreason_to_num(compiler_state_t *cstate, const char *reason)
  236. {
  237. const char *reasons[] = PFRES_NAMES;
  238. int i;
  239. for (i = 0; reasons[i]; i++) {
  240. if (pcap_strcasecmp(reason, reasons[i]) == 0)
  241. return (i);
  242. }
  243. bpf_error(cstate, "unknown PF reason");
  244. /*NOTREACHED*/
  245. }
  246. static int
  247. pfaction_to_num(compiler_state_t *cstate, const char *action)
  248. {
  249. if (pcap_strcasecmp(action, "pass") == 0 ||
  250. pcap_strcasecmp(action, "accept") == 0)
  251. return (PF_PASS);
  252. else if (pcap_strcasecmp(action, "drop") == 0 ||
  253. pcap_strcasecmp(action, "block") == 0)
  254. return (PF_DROP);
  255. #if HAVE_PF_NAT_THROUGH_PF_NORDR
  256. else if (pcap_strcasecmp(action, "rdr") == 0)
  257. return (PF_RDR);
  258. else if (pcap_strcasecmp(action, "nat") == 0)
  259. return (PF_NAT);
  260. else if (pcap_strcasecmp(action, "binat") == 0)
  261. return (PF_BINAT);
  262. else if (pcap_strcasecmp(action, "nordr") == 0)
  263. return (PF_NORDR);
  264. #endif
  265. else {
  266. bpf_error(cstate, "unknown PF action");
  267. /*NOTREACHED*/
  268. }
  269. }
  270. #else /* !HAVE_NET_PFVAR_H */
  271. static PCAP_NORETURN_DEF int
  272. pfreason_to_num(compiler_state_t *cstate, const char *reason _U_)
  273. {
  274. bpf_error(cstate, "libpcap was compiled on a machine without pf support");
  275. /*NOTREACHED*/
  276. }
  277. static PCAP_NORETURN_DEF int
  278. pfaction_to_num(compiler_state_t *cstate, const char *action _U_)
  279. {
  280. bpf_error(cstate, "libpcap was compiled on a machine without pf support");
  281. /*NOTREACHED*/
  282. }
  283. #endif /* HAVE_NET_PFVAR_H */
  284. DIAG_OFF_BISON_BYACC
  285. #line 332 "grammar.c" /* yacc.c:339 */
  286. # ifndef YY_NULLPTR
  287. # if defined __cplusplus && 201103L <= __cplusplus
  288. # define YY_NULLPTR nullptr
  289. # else
  290. # define YY_NULLPTR 0
  291. # endif
  292. # endif
  293. /* Enabling verbose error messages. */
  294. #ifdef YYERROR_VERBOSE
  295. # undef YYERROR_VERBOSE
  296. # define YYERROR_VERBOSE 1
  297. #else
  298. # define YYERROR_VERBOSE 0
  299. #endif
  300. /* In a future release of Bison, this section will be replaced
  301. by #include "grammar.h". */
  302. #ifndef YY_PCAP_GRAMMAR_H_INCLUDED
  303. # define YY_PCAP_GRAMMAR_H_INCLUDED
  304. /* Debug traces. */
  305. #ifndef YYDEBUG
  306. # define YYDEBUG 0
  307. #endif
  308. #if YYDEBUG
  309. extern int pcap_debug;
  310. #endif
  311. /* Token type. */
  312. #ifndef YYTOKENTYPE
  313. # define YYTOKENTYPE
  314. enum yytokentype
  315. {
  316. DST = 258,
  317. SRC = 259,
  318. HOST = 260,
  319. GATEWAY = 261,
  320. NET = 262,
  321. NETMASK = 263,
  322. PORT = 264,
  323. PORTRANGE = 265,
  324. LESS = 266,
  325. GREATER = 267,
  326. PROTO = 268,
  327. PROTOCHAIN = 269,
  328. CBYTE = 270,
  329. ARP = 271,
  330. RARP = 272,
  331. IP = 273,
  332. SCTP = 274,
  333. TCP = 275,
  334. UDP = 276,
  335. ICMP = 277,
  336. IGMP = 278,
  337. IGRP = 279,
  338. PIM = 280,
  339. VRRP = 281,
  340. CARP = 282,
  341. ATALK = 283,
  342. AARP = 284,
  343. DECNET = 285,
  344. LAT = 286,
  345. SCA = 287,
  346. MOPRC = 288,
  347. MOPDL = 289,
  348. TK_BROADCAST = 290,
  349. TK_MULTICAST = 291,
  350. NUM = 292,
  351. INBOUND = 293,
  352. OUTBOUND = 294,
  353. PF_IFNAME = 295,
  354. PF_RSET = 296,
  355. PF_RNR = 297,
  356. PF_SRNR = 298,
  357. PF_REASON = 299,
  358. PF_ACTION = 300,
  359. TYPE = 301,
  360. SUBTYPE = 302,
  361. DIR = 303,
  362. ADDR1 = 304,
  363. ADDR2 = 305,
  364. ADDR3 = 306,
  365. ADDR4 = 307,
  366. RA = 308,
  367. TA = 309,
  368. LINK = 310,
  369. GEQ = 311,
  370. LEQ = 312,
  371. NEQ = 313,
  372. ID = 314,
  373. EID = 315,
  374. HID = 316,
  375. HID6 = 317,
  376. AID = 318,
  377. LSH = 319,
  378. RSH = 320,
  379. LEN = 321,
  380. IPV6 = 322,
  381. ICMPV6 = 323,
  382. AH = 324,
  383. ESP = 325,
  384. VLAN = 326,
  385. MPLS = 327,
  386. PPPOED = 328,
  387. PPPOES = 329,
  388. GENEVE = 330,
  389. ISO = 331,
  390. ESIS = 332,
  391. CLNP = 333,
  392. ISIS = 334,
  393. L1 = 335,
  394. L2 = 336,
  395. IIH = 337,
  396. LSP = 338,
  397. SNP = 339,
  398. CSNP = 340,
  399. PSNP = 341,
  400. STP = 342,
  401. IPX = 343,
  402. NETBEUI = 344,
  403. LANE = 345,
  404. LLC = 346,
  405. METAC = 347,
  406. BCC = 348,
  407. SC = 349,
  408. ILMIC = 350,
  409. OAMF4EC = 351,
  410. OAMF4SC = 352,
  411. OAM = 353,
  412. OAMF4 = 354,
  413. CONNECTMSG = 355,
  414. METACONNECT = 356,
  415. VPI = 357,
  416. VCI = 358,
  417. RADIO = 359,
  418. FISU = 360,
  419. LSSU = 361,
  420. MSU = 362,
  421. HFISU = 363,
  422. HLSSU = 364,
  423. HMSU = 365,
  424. SIO = 366,
  425. OPC = 367,
  426. DPC = 368,
  427. SLS = 369,
  428. HSIO = 370,
  429. HOPC = 371,
  430. HDPC = 372,
  431. HSLS = 373,
  432. OR = 374,
  433. AND = 375,
  434. UMINUS = 376
  435. };
  436. #endif
  437. /* Tokens. */
  438. #define DST 258
  439. #define SRC 259
  440. #define HOST 260
  441. #define GATEWAY 261
  442. #define NET 262
  443. #define NETMASK 263
  444. #define PORT 264
  445. #define PORTRANGE 265
  446. #define LESS 266
  447. #define GREATER 267
  448. #define PROTO 268
  449. #define PROTOCHAIN 269
  450. #define CBYTE 270
  451. #define ARP 271
  452. #define RARP 272
  453. #define IP 273
  454. #define SCTP 274
  455. #define TCP 275
  456. #define UDP 276
  457. #define ICMP 277
  458. #define IGMP 278
  459. #define IGRP 279
  460. #define PIM 280
  461. #define VRRP 281
  462. #define CARP 282
  463. #define ATALK 283
  464. #define AARP 284
  465. #define DECNET 285
  466. #define LAT 286
  467. #define SCA 287
  468. #define MOPRC 288
  469. #define MOPDL 289
  470. #define TK_BROADCAST 290
  471. #define TK_MULTICAST 291
  472. #define NUM 292
  473. #define INBOUND 293
  474. #define OUTBOUND 294
  475. #define PF_IFNAME 295
  476. #define PF_RSET 296
  477. #define PF_RNR 297
  478. #define PF_SRNR 298
  479. #define PF_REASON 299
  480. #define PF_ACTION 300
  481. #define TYPE 301
  482. #define SUBTYPE 302
  483. #define DIR 303
  484. #define ADDR1 304
  485. #define ADDR2 305
  486. #define ADDR3 306
  487. #define ADDR4 307
  488. #define RA 308
  489. #define TA 309
  490. #define LINK 310
  491. #define GEQ 311
  492. #define LEQ 312
  493. #define NEQ 313
  494. #define ID 314
  495. #define EID 315
  496. #define HID 316
  497. #define HID6 317
  498. #define AID 318
  499. #define LSH 319
  500. #define RSH 320
  501. #define LEN 321
  502. #define IPV6 322
  503. #define ICMPV6 323
  504. #define AH 324
  505. #define ESP 325
  506. #define VLAN 326
  507. #define MPLS 327
  508. #define PPPOED 328
  509. #define PPPOES 329
  510. #define GENEVE 330
  511. #define ISO 331
  512. #define ESIS 332
  513. #define CLNP 333
  514. #define ISIS 334
  515. #define L1 335
  516. #define L2 336
  517. #define IIH 337
  518. #define LSP 338
  519. #define SNP 339
  520. #define CSNP 340
  521. #define PSNP 341
  522. #define STP 342
  523. #define IPX 343
  524. #define NETBEUI 344
  525. #define LANE 345
  526. #define LLC 346
  527. #define METAC 347
  528. #define BCC 348
  529. #define SC 349
  530. #define ILMIC 350
  531. #define OAMF4EC 351
  532. #define OAMF4SC 352
  533. #define OAM 353
  534. #define OAMF4 354
  535. #define CONNECTMSG 355
  536. #define METACONNECT 356
  537. #define VPI 357
  538. #define VCI 358
  539. #define RADIO 359
  540. #define FISU 360
  541. #define LSSU 361
  542. #define MSU 362
  543. #define HFISU 363
  544. #define HLSSU 364
  545. #define HMSU 365
  546. #define SIO 366
  547. #define OPC 367
  548. #define DPC 368
  549. #define SLS 369
  550. #define HSIO 370
  551. #define HOPC 371
  552. #define HDPC 372
  553. #define HSLS 373
  554. #define OR 374
  555. #define AND 375
  556. #define UMINUS 376
  557. /* Value type. */
  558. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  559. union YYSTYPE
  560. {
  561. #line 286 "grammar.y" /* yacc.c:355 */
  562. int i;
  563. bpf_u_int32 h;
  564. u_char *e;
  565. char *s;
  566. struct stmt *stmt;
  567. struct arth *a;
  568. struct {
  569. struct qual q;
  570. int atmfieldtype;
  571. int mtp3fieldtype;
  572. struct block *b;
  573. } blk;
  574. struct block *rblk;
  575. #line 630 "grammar.c" /* yacc.c:355 */
  576. };
  577. typedef union YYSTYPE YYSTYPE;
  578. # define YYSTYPE_IS_TRIVIAL 1
  579. # define YYSTYPE_IS_DECLARED 1
  580. #endif
  581. int pcap_parse (void *yyscanner, compiler_state_t *cstate);
  582. #endif /* !YY_PCAP_GRAMMAR_H_INCLUDED */
  583. /* Copy the second part of user declarations. */
  584. #line 646 "grammar.c" /* yacc.c:358 */
  585. #ifdef short
  586. # undef short
  587. #endif
  588. #ifdef YYTYPE_UINT8
  589. typedef YYTYPE_UINT8 yytype_uint8;
  590. #else
  591. typedef unsigned char yytype_uint8;
  592. #endif
  593. #ifdef YYTYPE_INT8
  594. typedef YYTYPE_INT8 yytype_int8;
  595. #else
  596. typedef signed char yytype_int8;
  597. #endif
  598. #ifdef YYTYPE_UINT16
  599. typedef YYTYPE_UINT16 yytype_uint16;
  600. #else
  601. typedef unsigned short int yytype_uint16;
  602. #endif
  603. #ifdef YYTYPE_INT16
  604. typedef YYTYPE_INT16 yytype_int16;
  605. #else
  606. typedef short int yytype_int16;
  607. #endif
  608. #ifndef YYSIZE_T
  609. # ifdef __SIZE_TYPE__
  610. # define YYSIZE_T __SIZE_TYPE__
  611. # elif defined size_t
  612. # define YYSIZE_T size_t
  613. # elif ! defined YYSIZE_T
  614. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  615. # define YYSIZE_T size_t
  616. # else
  617. # define YYSIZE_T unsigned int
  618. # endif
  619. #endif
  620. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  621. #ifndef YY_
  622. # if defined YYENABLE_NLS && YYENABLE_NLS
  623. # if ENABLE_NLS
  624. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  625. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  626. # endif
  627. # endif
  628. # ifndef YY_
  629. # define YY_(Msgid) Msgid
  630. # endif
  631. #endif
  632. #ifndef YY_ATTRIBUTE
  633. # if (defined __GNUC__ \
  634. && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
  635. || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  636. # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  637. # else
  638. # define YY_ATTRIBUTE(Spec) /* empty */
  639. # endif
  640. #endif
  641. #ifndef YY_ATTRIBUTE_PURE
  642. # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
  643. #endif
  644. #ifndef YY_ATTRIBUTE_UNUSED
  645. # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  646. #endif
  647. #if !defined _Noreturn \
  648. && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  649. # if defined _MSC_VER && 1200 <= _MSC_VER
  650. # define _Noreturn __declspec (noreturn)
  651. # else
  652. # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  653. # endif
  654. #endif
  655. /* Suppress unused-variable warnings by "using" E. */
  656. #if ! defined lint || defined __GNUC__
  657. # define YYUSE(E) ((void) (E))
  658. #else
  659. # define YYUSE(E) /* empty */
  660. #endif
  661. #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  662. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  663. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  664. _Pragma ("GCC diagnostic push") \
  665. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  666. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  667. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  668. _Pragma ("GCC diagnostic pop")
  669. #else
  670. # define YY_INITIAL_VALUE(Value) Value
  671. #endif
  672. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  673. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  674. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  675. #endif
  676. #ifndef YY_INITIAL_VALUE
  677. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  678. #endif
  679. #if ! defined yyoverflow || YYERROR_VERBOSE
  680. /* The parser invokes alloca or malloc; define the necessary symbols. */
  681. # ifdef YYSTACK_USE_ALLOCA
  682. # if YYSTACK_USE_ALLOCA
  683. # ifdef __GNUC__
  684. # define YYSTACK_ALLOC __builtin_alloca
  685. # elif defined __BUILTIN_VA_ARG_INCR
  686. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  687. # elif defined _AIX
  688. # define YYSTACK_ALLOC __alloca
  689. # elif defined _MSC_VER
  690. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  691. # define alloca _alloca
  692. # else
  693. # define YYSTACK_ALLOC alloca
  694. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  695. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  696. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  697. # ifndef EXIT_SUCCESS
  698. # define EXIT_SUCCESS 0
  699. # endif
  700. # endif
  701. # endif
  702. # endif
  703. # endif
  704. # ifdef YYSTACK_ALLOC
  705. /* Pacify GCC's 'empty if-body' warning. */
  706. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  707. # ifndef YYSTACK_ALLOC_MAXIMUM
  708. /* The OS might guarantee only one guard page at the bottom of the stack,
  709. and a page size can be as small as 4096 bytes. So we cannot safely
  710. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  711. to allow for a few compiler-allocated temporary stack slots. */
  712. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  713. # endif
  714. # else
  715. # define YYSTACK_ALLOC YYMALLOC
  716. # define YYSTACK_FREE YYFREE
  717. # ifndef YYSTACK_ALLOC_MAXIMUM
  718. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  719. # endif
  720. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  721. && ! ((defined YYMALLOC || defined malloc) \
  722. && (defined YYFREE || defined free)))
  723. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  724. # ifndef EXIT_SUCCESS
  725. # define EXIT_SUCCESS 0
  726. # endif
  727. # endif
  728. # ifndef YYMALLOC
  729. # define YYMALLOC malloc
  730. # if ! defined malloc && ! defined EXIT_SUCCESS
  731. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  732. # endif
  733. # endif
  734. # ifndef YYFREE
  735. # define YYFREE free
  736. # if ! defined free && ! defined EXIT_SUCCESS
  737. void free (void *); /* INFRINGES ON USER NAME SPACE */
  738. # endif
  739. # endif
  740. # endif
  741. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  742. #if (! defined yyoverflow \
  743. && (! defined __cplusplus \
  744. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  745. /* A type that is properly aligned for any stack member. */
  746. union yyalloc
  747. {
  748. yytype_int16 yyss_alloc;
  749. YYSTYPE yyvs_alloc;
  750. };
  751. /* The size of the maximum gap between one aligned stack and the next. */
  752. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  753. /* The size of an array large to enough to hold all stacks, each with
  754. N elements. */
  755. # define YYSTACK_BYTES(N) \
  756. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  757. + YYSTACK_GAP_MAXIMUM)
  758. # define YYCOPY_NEEDED 1
  759. /* Relocate STACK from its old location to the new one. The
  760. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  761. elements in the stack, and YYPTR gives the new location of the
  762. stack. Advance YYPTR to a properly aligned location for the next
  763. stack. */
  764. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  765. do \
  766. { \
  767. YYSIZE_T yynewbytes; \
  768. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  769. Stack = &yyptr->Stack_alloc; \
  770. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  771. yyptr += yynewbytes / sizeof (*yyptr); \
  772. } \
  773. while (0)
  774. #endif
  775. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  776. /* Copy COUNT objects from SRC to DST. The source and destination do
  777. not overlap. */
  778. # ifndef YYCOPY
  779. # if defined __GNUC__ && 1 < __GNUC__
  780. # define YYCOPY(Dst, Src, Count) \
  781. __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  782. # else
  783. # define YYCOPY(Dst, Src, Count) \
  784. do \
  785. { \
  786. YYSIZE_T yyi; \
  787. for (yyi = 0; yyi < (Count); yyi++) \
  788. (Dst)[yyi] = (Src)[yyi]; \
  789. } \
  790. while (0)
  791. # endif
  792. # endif
  793. #endif /* !YYCOPY_NEEDED */
  794. /* YYFINAL -- State number of the termination state. */
  795. #define YYFINAL 3
  796. /* YYLAST -- Last index in YYTABLE. */
  797. #define YYLAST 788
  798. /* YYNTOKENS -- Number of terminals. */
  799. #define YYNTOKENS 139
  800. /* YYNNTS -- Number of nonterminals. */
  801. #define YYNNTS 47
  802. /* YYNRULES -- Number of rules. */
  803. #define YYNRULES 220
  804. /* YYNSTATES -- Number of states. */
  805. #define YYNSTATES 294
  806. /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
  807. by yylex, with out-of-bounds checking. */
  808. #define YYUNDEFTOK 2
  809. #define YYMAXUTOK 376
  810. #define YYTRANSLATE(YYX) \
  811. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  812. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  813. as returned by yylex, without out-of-bounds checking. */
  814. static const yytype_uint8 yytranslate[] =
  815. {
  816. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  817. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  818. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  819. 2, 2, 2, 121, 2, 2, 2, 137, 123, 2,
  820. 130, 129, 126, 124, 2, 125, 2, 127, 2, 2,
  821. 2, 2, 2, 2, 2, 2, 2, 2, 136, 2,
  822. 133, 132, 131, 2, 2, 2, 2, 2, 2, 2,
  823. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  824. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  825. 2, 134, 2, 135, 138, 2, 2, 2, 2, 2,
  826. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  827. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  828. 2, 2, 2, 2, 122, 2, 2, 2, 2, 2,
  829. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  830. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  831. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  832. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  833. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  834. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  835. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  836. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  837. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  838. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  839. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  840. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  841. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  842. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  843. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  844. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  845. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  846. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  847. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  848. 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
  849. 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
  850. 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
  851. 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
  852. 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
  853. 115, 116, 117, 118, 119, 120, 128
  854. };
  855. #if YYDEBUG
  856. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  857. static const yytype_uint16 yyrline[] =
  858. {
  859. 0, 360, 360, 364, 366, 368, 369, 370, 371, 372,
  860. 374, 376, 378, 379, 381, 383, 384, 386, 388, 401,
  861. 410, 419, 428, 437, 439, 441, 443, 444, 445, 447,
  862. 449, 451, 452, 454, 455, 456, 457, 458, 459, 461,
  863. 462, 463, 464, 466, 468, 469, 470, 471, 472, 473,
  864. 476, 477, 480, 481, 482, 483, 484, 485, 486, 487,
  865. 488, 489, 490, 491, 494, 495, 496, 497, 500, 502,
  866. 503, 504, 505, 506, 507, 508, 509, 510, 511, 512,
  867. 513, 514, 515, 516, 517, 518, 519, 520, 521, 522,
  868. 523, 524, 525, 526, 527, 528, 529, 530, 531, 532,
  869. 533, 534, 535, 536, 537, 538, 539, 540, 542, 543,
  870. 544, 545, 546, 547, 548, 549, 550, 551, 552, 553,
  871. 554, 555, 556, 557, 558, 559, 560, 563, 564, 565,
  872. 566, 567, 568, 571, 576, 579, 583, 586, 587, 593,
  873. 594, 614, 630, 631, 652, 655, 656, 669, 670, 673,
  874. 676, 677, 678, 680, 681, 682, 684, 685, 687, 688,
  875. 689, 690, 691, 692, 693, 694, 695, 696, 697, 698,
  876. 699, 700, 701, 703, 704, 705, 706, 707, 709, 710,
  877. 712, 713, 714, 715, 716, 717, 718, 720, 721, 722,
  878. 723, 726, 727, 729, 730, 731, 732, 734, 741, 742,
  879. 745, 746, 747, 748, 749, 750, 753, 754, 755, 756,
  880. 757, 758, 759, 760, 762, 763, 764, 765, 767, 780,
  881. 781
  882. };
  883. #endif
  884. #if YYDEBUG || YYERROR_VERBOSE || 0
  885. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  886. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  887. static const char *const yytname[] =
  888. {
  889. "$end", "error", "$undefined", "DST", "SRC", "HOST", "GATEWAY", "NET",
  890. "NETMASK", "PORT", "PORTRANGE", "LESS", "GREATER", "PROTO", "PROTOCHAIN",
  891. "CBYTE", "ARP", "RARP", "IP", "SCTP", "TCP", "UDP", "ICMP", "IGMP",
  892. "IGRP", "PIM", "VRRP", "CARP", "ATALK", "AARP", "DECNET", "LAT", "SCA",
  893. "MOPRC", "MOPDL", "TK_BROADCAST", "TK_MULTICAST", "NUM", "INBOUND",
  894. "OUTBOUND", "PF_IFNAME", "PF_RSET", "PF_RNR", "PF_SRNR", "PF_REASON",
  895. "PF_ACTION", "TYPE", "SUBTYPE", "DIR", "ADDR1", "ADDR2", "ADDR3",
  896. "ADDR4", "RA", "TA", "LINK", "GEQ", "LEQ", "NEQ", "ID", "EID", "HID",
  897. "HID6", "AID", "LSH", "RSH", "LEN", "IPV6", "ICMPV6", "AH", "ESP",
  898. "VLAN", "MPLS", "PPPOED", "PPPOES", "GENEVE", "ISO", "ESIS", "CLNP",
  899. "ISIS", "L1", "L2", "IIH", "LSP", "SNP", "CSNP", "PSNP", "STP", "IPX",
  900. "NETBEUI", "LANE", "LLC", "METAC", "BCC", "SC", "ILMIC", "OAMF4EC",
  901. "OAMF4SC", "OAM", "OAMF4", "CONNECTMSG", "METACONNECT", "VPI", "VCI",
  902. "RADIO", "FISU", "LSSU", "MSU", "HFISU", "HLSSU", "HMSU", "SIO", "OPC",
  903. "DPC", "SLS", "HSIO", "HOPC", "HDPC", "HSLS", "OR", "AND", "'!'", "'|'",
  904. "'&'", "'+'", "'-'", "'*'", "'/'", "UMINUS", "')'", "'('", "'>'", "'='",
  905. "'<'", "'['", "']'", "':'", "'%'", "'^'", "$accept", "prog", "null",
  906. "expr", "and", "or", "id", "nid", "not", "paren", "pid", "qid", "term",
  907. "head", "rterm", "pqual", "dqual", "aqual", "ndaqual", "pname", "other",
  908. "pfvar", "p80211", "type", "subtype", "type_subtype", "pllc", "dir",
  909. "reason", "action", "relop", "irelop", "arth", "narth", "byteop", "pnum",
  910. "atmtype", "atmmultitype", "atmfield", "atmvalue", "atmfieldvalue",
  911. "atmlistvalue", "mtp2type", "mtp3field", "mtp3value", "mtp3fieldvalue",
  912. "mtp3listvalue", YY_NULLPTR
  913. };
  914. #endif
  915. # ifdef YYPRINT
  916. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  917. (internal) symbol number NUM (which must be that of a token). */
  918. static const yytype_uint16 yytoknum[] =
  919. {
  920. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  921. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  922. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  923. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  924. 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
  925. 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
  926. 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
  927. 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
  928. 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
  929. 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
  930. 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
  931. 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
  932. 375, 33, 124, 38, 43, 45, 42, 47, 376, 41,
  933. 40, 62, 61, 60, 91, 93, 58, 37, 94
  934. };
  935. # endif
  936. #define YYPACT_NINF -216
  937. #define yypact_value_is_default(Yystate) \
  938. (!!((Yystate) == (-216)))
  939. #define YYTABLE_NINF -42
  940. #define yytable_value_is_error(Yytable_value) \
  941. 0
  942. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  943. STATE-NUM. */
  944. static const yytype_int16 yypact[] =
  945. {
  946. -216, 24, 257, -216, 0, 12, 17, -216, -216, -216,
  947. -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,
  948. -216, -216, -216, -216, -216, -216, -216, -216, -216, 16,
  949. 25, 29, 72, -18, 55, -216, -216, -216, -216, -216,
  950. -216, -25, -25, -216, -25, -25, -216, -216, -216, -216,
  951. -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,
  952. -216, -24, -216, -216, -216, -216, -216, -216, -216, -216,
  953. -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,
  954. -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,
  955. 604, -216, -30, 489, 489, -216, 125, -216, 734, 3,
  956. -216, -216, -216, 183, -216, -216, -216, -216, -5, -216,
  957. 39, -216, -216, -54, -216, -216, -216, -216, -216, -216,
  958. -216, -216, -216, -25, -216, -216, -216, -216, -216, -216,
  959. 604, -16, -108, -216, -216, 373, 373, -216, -103, -10,
  960. 2, -216, -216, -7, 11, -216, -216, -216, 125, 125,
  961. -216, -3, 21, -216, -216, -216, -216, -216, -216, -216,
  962. -216, -216, -12, 77, -9, -216, -216, -216, -216, -216,
  963. -216, 78, -216, -216, -216, 604, -216, -216, -216, 604,
  964. 604, 604, 604, 604, 604, 604, 604, -216, -216, -216,
  965. 604, 604, 604, 604, -216, 111, 113, 114, -216, -216,
  966. -216, 115, 124, 126, -216, -216, -216, -216, -216, -216,
  967. -216, 131, 2, 575, -216, 373, 373, -216, 10, -216,
  968. -216, -216, -216, -216, 112, 137, 138, -216, -216, 47,
  969. -30, 2, 173, 176, 178, 186, -216, -216, 143, -216,
  970. -216, -216, -216, -216, -216, 127, -64, -64, 580, 598,
  971. -104, -104, -108, -108, 575, 575, 575, 575, -216, -98,
  972. -216, -216, -216, -47, -216, -216, -216, -49, -216, -216,
  973. -216, -216, 125, 125, -216, -216, -216, -216, -1, -216,
  974. 156, -216, 111, -216, 115, -216, -216, -216, -216, -216,
  975. 59, -216, -216, -216
  976. };
  977. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  978. Performed when YYTABLE does not specify something else to do. Zero
  979. means the default is an error. */
  980. static const yytype_uint8 yydefact[] =
  981. {
  982. 4, 0, 51, 1, 0, 0, 0, 71, 72, 70,
  983. 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
  984. 83, 84, 85, 86, 88, 87, 178, 113, 114, 0,
  985. 0, 0, 0, 0, 0, 69, 172, 89, 90, 91,
  986. 92, 116, 118, 119, 121, 123, 93, 94, 103, 95,
  987. 96, 97, 98, 99, 100, 102, 101, 104, 105, 106,
  988. 180, 142, 181, 182, 185, 186, 183, 184, 187, 188,
  989. 189, 190, 191, 192, 107, 200, 201, 202, 203, 204,
  990. 205, 206, 207, 208, 209, 210, 211, 212, 213, 24,
  991. 0, 25, 2, 51, 51, 5, 0, 31, 0, 50,
  992. 44, 124, 126, 0, 157, 156, 45, 46, 0, 48,
  993. 0, 110, 111, 0, 127, 128, 129, 130, 147, 148,
  994. 131, 149, 132, 0, 115, 117, 120, 122, 144, 143,
  995. 0, 0, 170, 11, 10, 51, 51, 32, 0, 157,
  996. 156, 15, 21, 18, 20, 22, 39, 12, 0, 0,
  997. 13, 53, 52, 64, 68, 65, 66, 67, 36, 37,
  998. 108, 109, 0, 0, 0, 58, 59, 60, 61, 62,
  999. 63, 34, 35, 38, 125, 0, 151, 153, 155, 0,
  1000. 0, 0, 0, 0, 0, 0, 0, 150, 152, 154,
  1001. 0, 0, 0, 0, 197, 0, 0, 0, 47, 193,
  1002. 218, 0, 0, 0, 49, 214, 174, 173, 176, 177,
  1003. 175, 0, 0, 0, 7, 51, 51, 6, 156, 9,
  1004. 8, 40, 171, 179, 0, 0, 0, 23, 26, 30,
  1005. 0, 29, 0, 0, 0, 0, 137, 138, 134, 141,
  1006. 135, 145, 146, 136, 33, 0, 168, 169, 166, 165,
  1007. 160, 161, 162, 163, 164, 167, 42, 43, 198, 0,
  1008. 194, 195, 219, 0, 215, 216, 112, 156, 17, 16,
  1009. 19, 14, 0, 0, 55, 57, 54, 56, 0, 158,
  1010. 0, 196, 0, 217, 0, 27, 28, 139, 140, 133,
  1011. 0, 199, 220, 159
  1012. };
  1013. /* YYPGOTO[NTERM-NUM]. */
  1014. static const yytype_int16 yypgoto[] =
  1015. {
  1016. -216, -216, -216, 193, -34, -215, -90, -135, 7, -2,
  1017. -216, -216, -80, -216, -216, -216, -216, 26, -216, 9,
  1018. -216, -216, -216, -216, -216, -216, -216, -216, -216, -216,
  1019. -43, 5, -26, -92, -216, -37, -216, -216, -216, -216,
  1020. -175, -216, -216, -216, -216, -174, -216
  1021. };
  1022. /* YYDEFGOTO[NTERM-NUM]. */
  1023. static const yytype_int16 yydefgoto[] =
  1024. {
  1025. -1, 1, 2, 138, 135, 136, 227, 147, 148, 130,
  1026. 229, 230, 95, 96, 97, 98, 171, 172, 173, 131,
  1027. 100, 101, 174, 238, 289, 240, 102, 243, 120, 122,
  1028. 192, 193, 103, 104, 211, 105, 106, 107, 108, 198,
  1029. 199, 259, 109, 110, 204, 205, 263
  1030. };
  1031. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  1032. positive, shift that token. If negative, reduce the rule whose
  1033. number is the opposite. If YYTABLE_NINF, syntax error. */
  1034. static const yytype_int16 yytable[] =
  1035. {
  1036. 94, 224, 139, -41, 124, 125, 146, 126, 127, 93,
  1037. -13, 99, 26, 137, 228, 273, 133, 134, 128, 118,
  1038. 258, 133, 185, 186, 3, 236, 221, 262, 241, 190,
  1039. 191, 281, 194, 190, 191, 129, 287, 111, 139, 123,
  1040. 123, 119, 123, 123, 282, 214, 219, 237, 284, 112,
  1041. 242, 176, 177, 178, 113, 217, 220, 140, 288, 150,
  1042. 183, 184, 185, 186, 132, 196, 116, 202, 206, 207,
  1043. -29, -29, 133, 190, 191, 114, 200, 208, 209, 210,
  1044. 223, 228, 283, 153, 115, 155, 212, 156, 157, 133,
  1045. 134, 94, 94, 140, 149, 176, 177, 178, 218, 218,
  1046. 93, 93, 99, 99, 213, 91, 195, 291, 201, 117,
  1047. 292, 150, 231, 197, 121, 203, 232, 233, 175, 222,
  1048. 225, 123, -41, -41, 139, 91, 187, 188, 189, -13,
  1049. -13, 223, -41, 216, 216, 137, 239, 175, 226, -13,
  1050. 234, 235, 215, 215, 99, 99, 149, 123, 194, 245,
  1051. 260, 261, 200, 246, 247, 248, 249, 250, 251, 252,
  1052. 253, 264, 26, 265, 254, 255, 256, 257, 266, 91,
  1053. 187, 188, 189, 268, 269, 270, 271, 274, 218, 267,
  1054. 275, 276, 285, 286, 141, 142, 143, 144, 145, 277,
  1055. 278, 179, 180, 290, 293, 92, 272, 244, 0, 0,
  1056. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1057. 0, 0, 0, 216, 94, 0, 0, 0, 0, 0,
  1058. 0, 0, 215, 215, 99, 99, 0, 0, 0, 0,
  1059. 0, 0, 0, 0, 0, 150, 150, 0, 0, 176,
  1060. 177, 178, 0, 0, 0, 0, 89, 179, 180, 181,
  1061. 182, 183, 184, 185, 186, 91, 0, -3, 0, 0,
  1062. 0, 0, 279, 280, 190, 191, 0, 0, 4, 5,
  1063. 149, 149, 6, 7, 8, 9, 10, 11, 12, 13,
  1064. 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
  1065. 24, 25, 0, 0, 26, 27, 28, 29, 30, 31,
  1066. 32, 33, 34, 0, 0, 181, 182, 183, 184, 185,
  1067. 186, 0, 35, 0, 187, 188, 189, 0, 0, 0,
  1068. 190, 191, 0, 36, 37, 38, 39, 40, 41, 42,
  1069. 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
  1070. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  1071. 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
  1072. 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
  1073. 83, 84, 85, 86, 87, 88, 0, 0, 89, 0,
  1074. 0, 0, 90, 0, 4, 5, 0, 91, 6, 7,
  1075. 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
  1076. 18, 19, 20, 21, 22, 23, 24, 25, 0, 0,
  1077. 26, 27, 28, 29, 30, 31, 32, 33, 34, 0,
  1078. 0, 0, 0, 0, 0, 0, 0, 0, 35, 0,
  1079. 0, 0, 141, 142, 143, 144, 145, 0, 0, 36,
  1080. 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
  1081. 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
  1082. 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
  1083. 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
  1084. 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
  1085. 87, 88, 0, 0, 89, 0, 0, 0, 90, 0,
  1086. 4, 5, 0, 91, 6, 7, 8, 9, 10, 11,
  1087. 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
  1088. 22, 23, 24, 25, 0, 0, 26, 27, 28, 29,
  1089. 30, 31, 32, 33, 34, 0, 0, 0, 0, 0,
  1090. 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,
  1091. 0, 0, 0, 0, 0, 36, 37, 38, 39, 40,
  1092. 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
  1093. 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
  1094. 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
  1095. 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
  1096. 81, 82, 83, 84, 85, 86, 87, 88, 0, 0,
  1097. 89, 0, 0, 0, 90, 0, 0, 0, 0, 91,
  1098. 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
  1099. 17, 18, 19, 20, 21, 22, 23, 24, 25, 179,
  1100. 180, 26, 0, 0, 179, 180, 0, 0, 0, 0,
  1101. 0, 0, 0, 0, 0, 0, 0, 0, 0, 35,
  1102. 0, 0, 179, 180, 0, 0, 0, 0, 0, 0,
  1103. 36, 37, 38, 39, 40, 0, 0, 0, 0, 0,
  1104. 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
  1105. 56, 57, 58, 59, 0, 0, 0, 181, 182, 183,
  1106. 184, 185, 186, 182, 183, 184, 185, 186, 74, 0,
  1107. 0, 0, 190, 191, 0, 0, 0, 190, 191, 0,
  1108. 0, 0, 183, 184, 185, 186, 0, 0, 0, 90,
  1109. 0, 0, 0, 0, 91, 190, 191, 151, 152, 153,
  1110. 154, 155, 0, 156, 157, 0, 0, 158, 159, 0,
  1111. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1112. 0, 0, 0, 0, 0, 0, 0, 0, 0, 160,
  1113. 161, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1114. 162, 163, 164, 165, 166, 167, 168, 169, 170
  1115. };
  1116. static const yytype_int16 yycheck[] =
  1117. {
  1118. 2, 8, 94, 0, 41, 42, 96, 44, 45, 2,
  1119. 0, 2, 37, 93, 149, 230, 119, 120, 42, 37,
  1120. 195, 119, 126, 127, 0, 37, 129, 201, 37, 137,
  1121. 138, 129, 37, 137, 138, 59, 37, 37, 130, 41,
  1122. 42, 59, 44, 45, 259, 135, 136, 59, 263, 37,
  1123. 59, 56, 57, 58, 37, 135, 136, 94, 59, 96,
  1124. 124, 125, 126, 127, 90, 108, 37, 110, 122, 123,
  1125. 119, 120, 119, 137, 138, 59, 37, 131, 132, 133,
  1126. 129, 216, 129, 5, 59, 7, 123, 9, 10, 119,
  1127. 120, 93, 94, 130, 96, 56, 57, 58, 135, 136,
  1128. 93, 94, 93, 94, 130, 130, 108, 282, 110, 37,
  1129. 284, 148, 149, 108, 59, 110, 119, 120, 134, 129,
  1130. 127, 123, 119, 120, 216, 130, 131, 132, 133, 119,
  1131. 120, 129, 129, 135, 136, 215, 59, 134, 127, 129,
  1132. 119, 120, 135, 136, 135, 136, 148, 149, 37, 175,
  1133. 37, 37, 37, 179, 180, 181, 182, 183, 184, 185,
  1134. 186, 37, 37, 37, 190, 191, 192, 193, 37, 130,
  1135. 131, 132, 133, 61, 37, 37, 129, 4, 215, 216,
  1136. 4, 3, 272, 273, 59, 60, 61, 62, 63, 3,
  1137. 47, 64, 65, 37, 135, 2, 230, 171, -1, -1,
  1138. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1139. -1, -1, -1, 215, 216, -1, -1, -1, -1, -1,
  1140. -1, -1, 215, 216, 215, 216, -1, -1, -1, -1,
  1141. -1, -1, -1, -1, -1, 272, 273, -1, -1, 56,
  1142. 57, 58, -1, -1, -1, -1, 121, 64, 65, 122,
  1143. 123, 124, 125, 126, 127, 130, -1, 0, -1, -1,
  1144. -1, -1, 135, 136, 137, 138, -1, -1, 11, 12,
  1145. 272, 273, 15, 16, 17, 18, 19, 20, 21, 22,
  1146. 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
  1147. 33, 34, -1, -1, 37, 38, 39, 40, 41, 42,
  1148. 43, 44, 45, -1, -1, 122, 123, 124, 125, 126,
  1149. 127, -1, 55, -1, 131, 132, 133, -1, -1, -1,
  1150. 137, 138, -1, 66, 67, 68, 69, 70, 71, 72,
  1151. 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
  1152. 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
  1153. 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
  1154. 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
  1155. 113, 114, 115, 116, 117, 118, -1, -1, 121, -1,
  1156. -1, -1, 125, -1, 11, 12, -1, 130, 15, 16,
  1157. 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
  1158. 27, 28, 29, 30, 31, 32, 33, 34, -1, -1,
  1159. 37, 38, 39, 40, 41, 42, 43, 44, 45, -1,
  1160. -1, -1, -1, -1, -1, -1, -1, -1, 55, -1,
  1161. -1, -1, 59, 60, 61, 62, 63, -1, -1, 66,
  1162. 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
  1163. 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
  1164. 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  1165. 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
  1166. 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
  1167. 117, 118, -1, -1, 121, -1, -1, -1, 125, -1,
  1168. 11, 12, -1, 130, 15, 16, 17, 18, 19, 20,
  1169. 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
  1170. 31, 32, 33, 34, -1, -1, 37, 38, 39, 40,
  1171. 41, 42, 43, 44, 45, -1, -1, -1, -1, -1,
  1172. -1, -1, -1, -1, 55, -1, -1, -1, -1, -1,
  1173. -1, -1, -1, -1, -1, 66, 67, 68, 69, 70,
  1174. 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
  1175. 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
  1176. 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
  1177. 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
  1178. 111, 112, 113, 114, 115, 116, 117, 118, -1, -1,
  1179. 121, -1, -1, -1, 125, -1, -1, -1, -1, 130,
  1180. 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
  1181. 26, 27, 28, 29, 30, 31, 32, 33, 34, 64,
  1182. 65, 37, -1, -1, 64, 65, -1, -1, -1, -1,
  1183. -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
  1184. -1, -1, 64, 65, -1, -1, -1, -1, -1, -1,
  1185. 66, 67, 68, 69, 70, -1, -1, -1, -1, -1,
  1186. 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
  1187. 86, 87, 88, 89, -1, -1, -1, 122, 123, 124,
  1188. 125, 126, 127, 123, 124, 125, 126, 127, 104, -1,
  1189. -1, -1, 137, 138, -1, -1, -1, 137, 138, -1,
  1190. -1, -1, 124, 125, 126, 127, -1, -1, -1, 125,
  1191. -1, -1, -1, -1, 130, 137, 138, 3, 4, 5,
  1192. 6, 7, -1, 9, 10, -1, -1, 13, 14, -1,
  1193. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1194. -1, -1, -1, -1, -1, -1, -1, -1, -1, 35,
  1195. 36, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1196. 46, 47, 48, 49, 50, 51, 52, 53, 54
  1197. };
  1198. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  1199. symbol of state STATE-NUM. */
  1200. static const yytype_uint8 yystos[] =
  1201. {
  1202. 0, 140, 141, 0, 11, 12, 15, 16, 17, 18,
  1203. 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
  1204. 29, 30, 31, 32, 33, 34, 37, 38, 39, 40,
  1205. 41, 42, 43, 44, 45, 55, 66, 67, 68, 69,
  1206. 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  1207. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
  1208. 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
  1209. 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
  1210. 110, 111, 112, 113, 114, 115, 116, 117, 118, 121,
  1211. 125, 130, 142, 147, 148, 151, 152, 153, 154, 158,
  1212. 159, 160, 165, 171, 172, 174, 175, 176, 177, 181,
  1213. 182, 37, 37, 37, 59, 59, 37, 37, 37, 59,
  1214. 167, 59, 168, 148, 174, 174, 174, 174, 42, 59,
  1215. 148, 158, 171, 119, 120, 143, 144, 151, 142, 172,
  1216. 174, 59, 60, 61, 62, 63, 145, 146, 147, 148,
  1217. 174, 3, 4, 5, 6, 7, 9, 10, 13, 14,
  1218. 35, 36, 46, 47, 48, 49, 50, 51, 52, 53,
  1219. 54, 155, 156, 157, 161, 134, 56, 57, 58, 64,
  1220. 65, 122, 123, 124, 125, 126, 127, 131, 132, 133,
  1221. 137, 138, 169, 170, 37, 148, 169, 170, 178, 179,
  1222. 37, 148, 169, 170, 183, 184, 122, 123, 131, 132,
  1223. 133, 173, 174, 171, 145, 147, 148, 151, 174, 145,
  1224. 151, 129, 129, 129, 8, 127, 127, 145, 146, 149,
  1225. 150, 174, 119, 120, 119, 120, 37, 59, 162, 59,
  1226. 164, 37, 59, 166, 156, 171, 171, 171, 171, 171,
  1227. 171, 171, 171, 171, 171, 171, 171, 171, 179, 180,
  1228. 37, 37, 184, 185, 37, 37, 37, 174, 61, 37,
  1229. 37, 129, 143, 144, 4, 4, 3, 3, 47, 135,
  1230. 136, 129, 144, 129, 144, 145, 145, 37, 59, 163,
  1231. 37, 179, 184, 135
  1232. };
  1233. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  1234. static const yytype_uint8 yyr1[] =
  1235. {
  1236. 0, 139, 140, 140, 141, 142, 142, 142, 142, 142,
  1237. 143, 144, 145, 145, 145, 146, 146, 146, 146, 146,
  1238. 146, 146, 146, 146, 147, 148, 149, 149, 149, 150,
  1239. 150, 151, 151, 152, 152, 152, 152, 152, 152, 153,
  1240. 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
  1241. 154, 154, 155, 155, 155, 155, 155, 155, 155, 155,
  1242. 155, 155, 155, 155, 156, 156, 156, 156, 157, 158,
  1243. 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
  1244. 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
  1245. 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
  1246. 158, 158, 158, 158, 158, 158, 158, 158, 159, 159,
  1247. 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
  1248. 159, 159, 159, 159, 159, 159, 159, 160, 160, 160,
  1249. 160, 160, 160, 161, 161, 161, 161, 162, 162, 163,
  1250. 163, 164, 165, 165, 165, 166, 166, 167, 167, 168,
  1251. 169, 169, 169, 170, 170, 170, 171, 171, 172, 172,
  1252. 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
  1253. 172, 172, 172, 173, 173, 173, 173, 173, 174, 174,
  1254. 175, 175, 175, 175, 175, 175, 175, 176, 176, 176,
  1255. 176, 177, 177, 178, 178, 178, 178, 179, 180, 180,
  1256. 181, 181, 181, 181, 181, 181, 182, 182, 182, 182,
  1257. 182, 182, 182, 182, 183, 183, 183, 183, 184, 185,
  1258. 185
  1259. };
  1260. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  1261. static const yytype_uint8 yyr2[] =
  1262. {
  1263. 0, 2, 2, 1, 0, 1, 3, 3, 3, 3,
  1264. 1, 1, 1, 1, 3, 1, 3, 3, 1, 3,
  1265. 1, 1, 1, 2, 1, 1, 1, 3, 3, 1,
  1266. 1, 1, 2, 3, 2, 2, 2, 2, 2, 2,
  1267. 3, 1, 3, 3, 1, 1, 1, 2, 1, 2,
  1268. 1, 0, 1, 1, 3, 3, 3, 3, 1, 1,
  1269. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1270. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1271. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1272. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1273. 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
  1274. 2, 2, 4, 1, 1, 2, 1, 2, 1, 1,
  1275. 2, 1, 2, 1, 1, 2, 1, 2, 2, 2,
  1276. 2, 2, 2, 4, 2, 2, 2, 1, 1, 1,
  1277. 1, 1, 1, 2, 2, 1, 1, 1, 1, 1,
  1278. 1, 1, 1, 1, 1, 1, 1, 1, 4, 6,
  1279. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  1280. 2, 3, 1, 1, 1, 1, 1, 1, 1, 3,
  1281. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1282. 1, 1, 1, 1, 2, 2, 3, 1, 1, 3,
  1283. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1284. 1, 1, 1, 1, 1, 2, 2, 3, 1, 1,
  1285. 3
  1286. };
  1287. #define yyerrok (yyerrstatus = 0)
  1288. #define yyclearin (yychar = YYEMPTY)
  1289. #define YYEMPTY (-2)
  1290. #define YYEOF 0
  1291. #define YYACCEPT goto yyacceptlab
  1292. #define YYABORT goto yyabortlab
  1293. #define YYERROR goto yyerrorlab
  1294. #define YYRECOVERING() (!!yyerrstatus)
  1295. #define YYBACKUP(Token, Value) \
  1296. do \
  1297. if (yychar == YYEMPTY) \
  1298. { \
  1299. yychar = (Token); \
  1300. yylval = (Value); \
  1301. YYPOPSTACK (yylen); \
  1302. yystate = *yyssp; \
  1303. goto yybackup; \
  1304. } \
  1305. else \
  1306. { \
  1307. yyerror (yyscanner, cstate, YY_("syntax error: cannot back up")); \
  1308. YYERROR; \
  1309. } \
  1310. while (0)
  1311. /* Error token number */
  1312. #define YYTERROR 1
  1313. #define YYERRCODE 256
  1314. /* Enable debugging if requested. */
  1315. #if YYDEBUG
  1316. # ifndef YYFPRINTF
  1317. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  1318. # define YYFPRINTF fprintf
  1319. # endif
  1320. # define YYDPRINTF(Args) \
  1321. do { \
  1322. if (yydebug) \
  1323. YYFPRINTF Args; \
  1324. } while (0)
  1325. /* This macro is provided for backward compatibility. */
  1326. #ifndef YY_LOCATION_PRINT
  1327. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  1328. #endif
  1329. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  1330. do { \
  1331. if (yydebug) \
  1332. { \
  1333. YYFPRINTF (stderr, "%s ", Title); \
  1334. yy_symbol_print (stderr, \
  1335. Type, Value, yyscanner, cstate); \
  1336. YYFPRINTF (stderr, "\n"); \
  1337. } \
  1338. } while (0)
  1339. /*----------------------------------------.
  1340. | Print this symbol's value on YYOUTPUT. |
  1341. `----------------------------------------*/
  1342. static void
  1343. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, compiler_state_t *cstate)
  1344. {
  1345. FILE *yyo = yyoutput;
  1346. YYUSE (yyo);
  1347. YYUSE (yyscanner);
  1348. YYUSE (cstate);
  1349. if (!yyvaluep)
  1350. return;
  1351. # ifdef YYPRINT
  1352. if (yytype < YYNTOKENS)
  1353. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  1354. # endif
  1355. YYUSE (yytype);
  1356. }
  1357. /*--------------------------------.
  1358. | Print this symbol on YYOUTPUT. |
  1359. `--------------------------------*/
  1360. static void
  1361. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, compiler_state_t *cstate)
  1362. {
  1363. YYFPRINTF (yyoutput, "%s %s (",
  1364. yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  1365. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, cstate);
  1366. YYFPRINTF (yyoutput, ")");
  1367. }
  1368. /*------------------------------------------------------------------.
  1369. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  1370. | TOP (included). |
  1371. `------------------------------------------------------------------*/
  1372. static void
  1373. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  1374. {
  1375. YYFPRINTF (stderr, "Stack now");
  1376. for (; yybottom <= yytop; yybottom++)
  1377. {
  1378. int yybot = *yybottom;
  1379. YYFPRINTF (stderr, " %d", yybot);
  1380. }
  1381. YYFPRINTF (stderr, "\n");
  1382. }
  1383. # define YY_STACK_PRINT(Bottom, Top) \
  1384. do { \
  1385. if (yydebug) \
  1386. yy_stack_print ((Bottom), (Top)); \
  1387. } while (0)
  1388. /*------------------------------------------------.
  1389. | Report that the YYRULE is going to be reduced. |
  1390. `------------------------------------------------*/
  1391. static void
  1392. yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *yyscanner, compiler_state_t *cstate)
  1393. {
  1394. unsigned long int yylno = yyrline[yyrule];
  1395. int yynrhs = yyr2[yyrule];
  1396. int yyi;
  1397. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  1398. yyrule - 1, yylno);
  1399. /* The symbols being reduced. */
  1400. for (yyi = 0; yyi < yynrhs; yyi++)
  1401. {
  1402. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  1403. yy_symbol_print (stderr,
  1404. yystos[yyssp[yyi + 1 - yynrhs]],
  1405. &(yyvsp[(yyi + 1) - (yynrhs)])
  1406. , yyscanner, cstate);
  1407. YYFPRINTF (stderr, "\n");
  1408. }
  1409. }
  1410. # define YY_REDUCE_PRINT(Rule) \
  1411. do { \
  1412. if (yydebug) \
  1413. yy_reduce_print (yyssp, yyvsp, Rule, yyscanner, cstate); \
  1414. } while (0)
  1415. /* Nonzero means print parse trace. It is left uninitialized so that
  1416. multiple parsers can coexist. */
  1417. int yydebug;
  1418. #else /* !YYDEBUG */
  1419. # define YYDPRINTF(Args)
  1420. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1421. # define YY_STACK_PRINT(Bottom, Top)
  1422. # define YY_REDUCE_PRINT(Rule)
  1423. #endif /* !YYDEBUG */
  1424. /* YYINITDEPTH -- initial size of the parser's stacks. */
  1425. #ifndef YYINITDEPTH
  1426. # define YYINITDEPTH 200
  1427. #endif
  1428. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1429. if the built-in stack extension method is used).
  1430. Do not make this value too large; the results are undefined if
  1431. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1432. evaluated with infinite-precision integer arithmetic. */
  1433. #ifndef YYMAXDEPTH
  1434. # define YYMAXDEPTH 10000
  1435. #endif
  1436. #if YYERROR_VERBOSE
  1437. # ifndef yystrlen
  1438. # if defined __GLIBC__ && defined _STRING_H
  1439. # define yystrlen strlen
  1440. # else
  1441. /* Return the length of YYSTR. */
  1442. static YYSIZE_T
  1443. yystrlen (const char *yystr)
  1444. {
  1445. YYSIZE_T yylen;
  1446. for (yylen = 0; yystr[yylen]; yylen++)
  1447. continue;
  1448. return yylen;
  1449. }
  1450. # endif
  1451. # endif
  1452. # ifndef yystpcpy
  1453. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1454. # define yystpcpy stpcpy
  1455. # else
  1456. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1457. YYDEST. */
  1458. static char *
  1459. yystpcpy (char *yydest, const char *yysrc)
  1460. {
  1461. char *yyd = yydest;
  1462. const char *yys = yysrc;
  1463. while ((*yyd++ = *yys++) != '\0')
  1464. continue;
  1465. return yyd - 1;
  1466. }
  1467. # endif
  1468. # endif
  1469. # ifndef yytnamerr
  1470. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1471. quotes and backslashes, so that it's suitable for yyerror. The
  1472. heuristic is that double-quoting is unnecessary unless the string
  1473. contains an apostrophe, a comma, or backslash (other than
  1474. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  1475. null, do not copy; instead, return the length of what the result
  1476. would have been. */
  1477. static YYSIZE_T
  1478. yytnamerr (char *yyres, const char *yystr)
  1479. {
  1480. if (*yystr == '"')
  1481. {
  1482. YYSIZE_T yyn = 0;
  1483. char const *yyp = yystr;
  1484. for (;;)
  1485. switch (*++yyp)
  1486. {
  1487. case '\'':
  1488. case ',':
  1489. goto do_not_strip_quotes;
  1490. case '\\':
  1491. if (*++yyp != '\\')
  1492. goto do_not_strip_quotes;
  1493. /* Fall through. */
  1494. default:
  1495. if (yyres)
  1496. yyres[yyn] = *yyp;
  1497. yyn++;
  1498. break;
  1499. case '"':
  1500. if (yyres)
  1501. yyres[yyn] = '\0';
  1502. return yyn;
  1503. }
  1504. do_not_strip_quotes: ;
  1505. }
  1506. if (! yyres)
  1507. return yystrlen (yystr);
  1508. return yystpcpy (yyres, yystr) - yyres;
  1509. }
  1510. # endif
  1511. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  1512. about the unexpected token YYTOKEN for the state stack whose top is
  1513. YYSSP.
  1514. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  1515. not large enough to hold the message. In that case, also set
  1516. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  1517. required number of bytes is too large to store. */
  1518. static int
  1519. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  1520. yytype_int16 *yyssp, int yytoken)
  1521. {
  1522. YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  1523. YYSIZE_T yysize = yysize0;
  1524. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1525. /* Internationalized format string. */
  1526. const char *yyformat = YY_NULLPTR;
  1527. /* Arguments of yyformat. */
  1528. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1529. /* Number of reported tokens (one for the "unexpected", one per
  1530. "expected"). */
  1531. int yycount = 0;
  1532. /* There are many possibilities here to consider:
  1533. - If this state is a consistent state with a default action, then
  1534. the only way this function was invoked is if the default action
  1535. is an error action. In that case, don't check for expected
  1536. tokens because there are none.
  1537. - The only way there can be no lookahead present (in yychar) is if
  1538. this state is a consistent state with a default action. Thus,
  1539. detecting the absence of a lookahead is sufficient to determine
  1540. that there is no unexpected or expected token to report. In that
  1541. case, just report a simple "syntax error".
  1542. - Don't assume there isn't a lookahead just because this state is a
  1543. consistent state with a default action. There might have been a
  1544. previous inconsistent state, consistent state with a non-default
  1545. action, or user semantic action that manipulated yychar.
  1546. - Of course, the expected token list depends on states to have
  1547. correct lookahead information, and it depends on the parser not
  1548. to perform extra reductions after fetching a lookahead from the
  1549. scanner and before detecting a syntax error. Thus, state merging
  1550. (from LALR or IELR) and default reductions corrupt the expected
  1551. token list. However, the list is correct for canonical LR with
  1552. one exception: it will still contain any token that will not be
  1553. accepted due to an error action in a later state.
  1554. */
  1555. if (yytoken != YYEMPTY)
  1556. {
  1557. int yyn = yypact[*yyssp];
  1558. yyarg[yycount++] = yytname[yytoken];
  1559. if (!yypact_value_is_default (yyn))
  1560. {
  1561. /* Start YYX at -YYN if negative to avoid negative indexes in
  1562. YYCHECK. In other words, skip the first -YYN actions for
  1563. this state because they are default actions. */
  1564. int yyxbegin = yyn < 0 ? -yyn : 0;
  1565. /* Stay within bounds of both yycheck and yytname. */
  1566. int yychecklim = YYLAST - yyn + 1;
  1567. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1568. int yyx;
  1569. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1570. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  1571. && !yytable_value_is_error (yytable[yyx + yyn]))
  1572. {
  1573. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1574. {
  1575. yycount = 1;
  1576. yysize = yysize0;
  1577. break;
  1578. }
  1579. yyarg[yycount++] = yytname[yyx];
  1580. {
  1581. YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  1582. if (! (yysize <= yysize1
  1583. && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1584. return 2;
  1585. yysize = yysize1;
  1586. }
  1587. }
  1588. }
  1589. }
  1590. switch (yycount)
  1591. {
  1592. # define YYCASE_(N, S) \
  1593. case N: \
  1594. yyformat = S; \
  1595. break
  1596. YYCASE_(0, YY_("syntax error"));
  1597. YYCASE_(1, YY_("syntax error, unexpected %s"));
  1598. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1599. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  1600. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  1601. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  1602. # undef YYCASE_
  1603. }
  1604. {
  1605. YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
  1606. if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1607. return 2;
  1608. yysize = yysize1;
  1609. }
  1610. if (*yymsg_alloc < yysize)
  1611. {
  1612. *yymsg_alloc = 2 * yysize;
  1613. if (! (yysize <= *yymsg_alloc
  1614. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  1615. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  1616. return 1;
  1617. }
  1618. /* Avoid sprintf, as that infringes on the user's name space.
  1619. Don't have undefined behavior even if the translation
  1620. produced a string with the wrong number of "%s"s. */
  1621. {
  1622. char *yyp = *yymsg;
  1623. int yyi = 0;
  1624. while ((*yyp = *yyformat) != '\0')
  1625. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  1626. {
  1627. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1628. yyformat += 2;
  1629. }
  1630. else
  1631. {
  1632. yyp++;
  1633. yyformat++;
  1634. }
  1635. }
  1636. return 0;
  1637. }
  1638. #endif /* YYERROR_VERBOSE */
  1639. /*-----------------------------------------------.
  1640. | Release the memory associated to this symbol. |
  1641. `-----------------------------------------------*/
  1642. static void
  1643. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, compiler_state_t *cstate)
  1644. {
  1645. YYUSE (yyvaluep);
  1646. YYUSE (yyscanner);
  1647. YYUSE (cstate);
  1648. if (!yymsg)
  1649. yymsg = "Deleting";
  1650. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1651. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1652. YYUSE (yytype);
  1653. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1654. }
  1655. /*----------.
  1656. | yyparse. |
  1657. `----------*/
  1658. int
  1659. yyparse (void *yyscanner, compiler_state_t *cstate)
  1660. {
  1661. /* The lookahead symbol. */
  1662. int yychar;
  1663. /* The semantic value of the lookahead symbol. */
  1664. /* Default value used for initialization, for pacifying older GCCs
  1665. or non-GCC compilers. */
  1666. YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
  1667. YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
  1668. /* Number of syntax errors so far. */
  1669. int yynerrs;
  1670. int yystate;
  1671. /* Number of tokens to shift before error messages enabled. */
  1672. int yyerrstatus;
  1673. /* The stacks and their tools:
  1674. 'yyss': related to states.
  1675. 'yyvs': related to semantic values.
  1676. Refer to the stacks through separate pointers, to allow yyoverflow
  1677. to reallocate them elsewhere. */
  1678. /* The state stack. */
  1679. yytype_int16 yyssa[YYINITDEPTH];
  1680. yytype_int16 *yyss;
  1681. yytype_int16 *yyssp;
  1682. /* The semantic value stack. */
  1683. YYSTYPE yyvsa[YYINITDEPTH];
  1684. YYSTYPE *yyvs;
  1685. YYSTYPE *yyvsp;
  1686. YYSIZE_T yystacksize;
  1687. int yyn;
  1688. int yyresult;
  1689. /* Lookahead token as an internal (translated) token number. */
  1690. int yytoken = 0;
  1691. /* The variables used to return semantic value and location from the
  1692. action routines. */
  1693. YYSTYPE yyval;
  1694. #if YYERROR_VERBOSE
  1695. /* Buffer for error messages, and its allocated size. */
  1696. char yymsgbuf[128];
  1697. char *yymsg = yymsgbuf;
  1698. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1699. #endif
  1700. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  1701. /* The number of symbols on the RHS of the reduced rule.
  1702. Keep to zero when no symbol should be popped. */
  1703. int yylen = 0;
  1704. yyssp = yyss = yyssa;
  1705. yyvsp = yyvs = yyvsa;
  1706. yystacksize = YYINITDEPTH;
  1707. YYDPRINTF ((stderr, "Starting parse\n"));
  1708. yystate = 0;
  1709. yyerrstatus = 0;
  1710. yynerrs = 0;
  1711. yychar = YYEMPTY; /* Cause a token to be read. */
  1712. goto yysetstate;
  1713. /*------------------------------------------------------------.
  1714. | yynewstate -- Push a new state, which is found in yystate. |
  1715. `------------------------------------------------------------*/
  1716. yynewstate:
  1717. /* In all cases, when you get here, the value and location stacks
  1718. have just been pushed. So pushing a state here evens the stacks. */
  1719. yyssp++;
  1720. yysetstate:
  1721. *yyssp = yystate;
  1722. if (yyss + yystacksize - 1 <= yyssp)
  1723. {
  1724. /* Get the current used size of the three stacks, in elements. */
  1725. YYSIZE_T yysize = yyssp - yyss + 1;
  1726. #ifdef yyoverflow
  1727. {
  1728. /* Give user a chance to reallocate the stack. Use copies of
  1729. these so that the &'s don't force the real ones into
  1730. memory. */
  1731. YYSTYPE *yyvs1 = yyvs;
  1732. yytype_int16 *yyss1 = yyss;
  1733. /* Each stack pointer address is followed by the size of the
  1734. data in use in that stack, in bytes. This used to be a
  1735. conditional around just the two extra args, but that might
  1736. be undefined if yyoverflow is a macro. */
  1737. yyoverflow (YY_("memory exhausted"),
  1738. &yyss1, yysize * sizeof (*yyssp),
  1739. &yyvs1, yysize * sizeof (*yyvsp),
  1740. &yystacksize);
  1741. yyss = yyss1;
  1742. yyvs = yyvs1;
  1743. }
  1744. #else /* no yyoverflow */
  1745. # ifndef YYSTACK_RELOCATE
  1746. goto yyexhaustedlab;
  1747. # else
  1748. /* Extend the stack our own way. */
  1749. if (YYMAXDEPTH <= yystacksize)
  1750. goto yyexhaustedlab;
  1751. yystacksize *= 2;
  1752. if (YYMAXDEPTH < yystacksize)
  1753. yystacksize = YYMAXDEPTH;
  1754. {
  1755. yytype_int16 *yyss1 = yyss;
  1756. union yyalloc *yyptr =
  1757. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1758. if (! yyptr)
  1759. goto yyexhaustedlab;
  1760. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1761. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1762. # undef YYSTACK_RELOCATE
  1763. if (yyss1 != yyssa)
  1764. YYSTACK_FREE (yyss1);
  1765. }
  1766. # endif
  1767. #endif /* no yyoverflow */
  1768. yyssp = yyss + yysize - 1;
  1769. yyvsp = yyvs + yysize - 1;
  1770. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1771. (unsigned long int) yystacksize));
  1772. if (yyss + yystacksize - 1 <= yyssp)
  1773. YYABORT;
  1774. }
  1775. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1776. if (yystate == YYFINAL)
  1777. YYACCEPT;
  1778. goto yybackup;
  1779. /*-----------.
  1780. | yybackup. |
  1781. `-----------*/
  1782. yybackup:
  1783. /* Do appropriate processing given the current state. Read a
  1784. lookahead token if we need one and don't already have one. */
  1785. /* First try to decide what to do without reference to lookahead token. */
  1786. yyn = yypact[yystate];
  1787. if (yypact_value_is_default (yyn))
  1788. goto yydefault;
  1789. /* Not known => get a lookahead token if don't already have one. */
  1790. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1791. if (yychar == YYEMPTY)
  1792. {
  1793. YYDPRINTF ((stderr, "Reading a token: "));
  1794. yychar = yylex (&yylval, yyscanner);
  1795. }
  1796. if (yychar <= YYEOF)
  1797. {
  1798. yychar = yytoken = YYEOF;
  1799. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1800. }
  1801. else
  1802. {
  1803. yytoken = YYTRANSLATE (yychar);
  1804. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1805. }
  1806. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1807. detect an error, take that action. */
  1808. yyn += yytoken;
  1809. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1810. goto yydefault;
  1811. yyn = yytable[yyn];
  1812. if (yyn <= 0)
  1813. {
  1814. if (yytable_value_is_error (yyn))
  1815. goto yyerrlab;
  1816. yyn = -yyn;
  1817. goto yyreduce;
  1818. }
  1819. /* Count tokens shifted since error; after three, turn off error
  1820. status. */
  1821. if (yyerrstatus)
  1822. yyerrstatus--;
  1823. /* Shift the lookahead token. */
  1824. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1825. /* Discard the shifted token. */
  1826. yychar = YYEMPTY;
  1827. yystate = yyn;
  1828. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1829. *++yyvsp = yylval;
  1830. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1831. goto yynewstate;
  1832. /*-----------------------------------------------------------.
  1833. | yydefault -- do the default action for the current state. |
  1834. `-----------------------------------------------------------*/
  1835. yydefault:
  1836. yyn = yydefact[yystate];
  1837. if (yyn == 0)
  1838. goto yyerrlab;
  1839. goto yyreduce;
  1840. /*-----------------------------.
  1841. | yyreduce -- Do a reduction. |
  1842. `-----------------------------*/
  1843. yyreduce:
  1844. /* yyn is the number of a rule to reduce with. */
  1845. yylen = yyr2[yyn];
  1846. /* If YYLEN is nonzero, implement the default value of the action:
  1847. '$$ = $1'.
  1848. Otherwise, the following line sets YYVAL to garbage.
  1849. This behavior is undocumented and Bison
  1850. users should not rely upon it. Assigning to YYVAL
  1851. unconditionally makes the parser a bit smaller, and it avoids a
  1852. GCC warning that YYVAL may be used uninitialized. */
  1853. yyval = yyvsp[1-yylen];
  1854. YY_REDUCE_PRINT (yyn);
  1855. switch (yyn)
  1856. {
  1857. case 2:
  1858. #line 361 "grammar.y" /* yacc.c:1646 */
  1859. {
  1860. finish_parse(cstate, (yyvsp[0].blk).b);
  1861. }
  1862. #line 2085 "grammar.c" /* yacc.c:1646 */
  1863. break;
  1864. case 4:
  1865. #line 366 "grammar.y" /* yacc.c:1646 */
  1866. { (yyval.blk).q = qerr; }
  1867. #line 2091 "grammar.c" /* yacc.c:1646 */
  1868. break;
  1869. case 6:
  1870. #line 369 "grammar.y" /* yacc.c:1646 */
  1871. { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  1872. #line 2097 "grammar.c" /* yacc.c:1646 */
  1873. break;
  1874. case 7:
  1875. #line 370 "grammar.y" /* yacc.c:1646 */
  1876. { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  1877. #line 2103 "grammar.c" /* yacc.c:1646 */
  1878. break;
  1879. case 8:
  1880. #line 371 "grammar.y" /* yacc.c:1646 */
  1881. { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  1882. #line 2109 "grammar.c" /* yacc.c:1646 */
  1883. break;
  1884. case 9:
  1885. #line 372 "grammar.y" /* yacc.c:1646 */
  1886. { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  1887. #line 2115 "grammar.c" /* yacc.c:1646 */
  1888. break;
  1889. case 10:
  1890. #line 374 "grammar.y" /* yacc.c:1646 */
  1891. { (yyval.blk) = (yyvsp[-1].blk); }
  1892. #line 2121 "grammar.c" /* yacc.c:1646 */
  1893. break;
  1894. case 11:
  1895. #line 376 "grammar.y" /* yacc.c:1646 */
  1896. { (yyval.blk) = (yyvsp[-1].blk); }
  1897. #line 2127 "grammar.c" /* yacc.c:1646 */
  1898. break;
  1899. case 13:
  1900. #line 379 "grammar.y" /* yacc.c:1646 */
  1901. { (yyval.blk).b = gen_ncode(cstate, NULL, (bpf_u_int32)(yyvsp[0].i),
  1902. (yyval.blk).q = (yyvsp[-1].blk).q); }
  1903. #line 2134 "grammar.c" /* yacc.c:1646 */
  1904. break;
  1905. case 14:
  1906. #line 381 "grammar.y" /* yacc.c:1646 */
  1907. { (yyval.blk) = (yyvsp[-1].blk); }
  1908. #line 2140 "grammar.c" /* yacc.c:1646 */
  1909. break;
  1910. case 15:
  1911. #line 383 "grammar.y" /* yacc.c:1646 */
  1912. { (yyval.blk).b = gen_scode(cstate, (yyvsp[0].s), (yyval.blk).q = (yyvsp[-1].blk).q); }
  1913. #line 2146 "grammar.c" /* yacc.c:1646 */
  1914. break;
  1915. case 16:
  1916. #line 384 "grammar.y" /* yacc.c:1646 */
  1917. { (yyval.blk).b = gen_mcode(cstate, (yyvsp[-2].s), NULL, (yyvsp[0].i),
  1918. (yyval.blk).q = (yyvsp[-3].blk).q); }
  1919. #line 2153 "grammar.c" /* yacc.c:1646 */
  1920. break;
  1921. case 17:
  1922. #line 386 "grammar.y" /* yacc.c:1646 */
  1923. { (yyval.blk).b = gen_mcode(cstate, (yyvsp[-2].s), (yyvsp[0].s), 0,
  1924. (yyval.blk).q = (yyvsp[-3].blk).q); }
  1925. #line 2160 "grammar.c" /* yacc.c:1646 */
  1926. break;
  1927. case 18:
  1928. #line 388 "grammar.y" /* yacc.c:1646 */
  1929. {
  1930. /* Decide how to parse HID based on proto */
  1931. (yyval.blk).q = (yyvsp[-1].blk).q;
  1932. if ((yyval.blk).q.addr == Q_PORT)
  1933. bpf_error(cstate, "'port' modifier applied to ip host");
  1934. else if ((yyval.blk).q.addr == Q_PORTRANGE)
  1935. bpf_error(cstate, "'portrange' modifier applied to ip host");
  1936. else if ((yyval.blk).q.addr == Q_PROTO)
  1937. bpf_error(cstate, "'proto' modifier applied to ip host");
  1938. else if ((yyval.blk).q.addr == Q_PROTOCHAIN)
  1939. bpf_error(cstate, "'protochain' modifier applied to ip host");
  1940. (yyval.blk).b = gen_ncode(cstate, (yyvsp[0].s), 0, (yyval.blk).q);
  1941. }
  1942. #line 2178 "grammar.c" /* yacc.c:1646 */
  1943. break;
  1944. case 19:
  1945. #line 401 "grammar.y" /* yacc.c:1646 */
  1946. {
  1947. #ifdef INET6
  1948. (yyval.blk).b = gen_mcode6(cstate, (yyvsp[-2].s), NULL, (yyvsp[0].i),
  1949. (yyval.blk).q = (yyvsp[-3].blk).q);
  1950. #else
  1951. bpf_error(cstate, "'ip6addr/prefixlen' not supported "
  1952. "in this configuration");
  1953. #endif /*INET6*/
  1954. }
  1955. #line 2192 "grammar.c" /* yacc.c:1646 */
  1956. break;
  1957. case 20:
  1958. #line 410 "grammar.y" /* yacc.c:1646 */
  1959. {
  1960. #ifdef INET6
  1961. (yyval.blk).b = gen_mcode6(cstate, (yyvsp[0].s), 0, 128,
  1962. (yyval.blk).q = (yyvsp[-1].blk).q);
  1963. #else
  1964. bpf_error(cstate, "'ip6addr' not supported "
  1965. "in this configuration");
  1966. #endif /*INET6*/
  1967. }
  1968. #line 2206 "grammar.c" /* yacc.c:1646 */
  1969. break;
  1970. case 21:
  1971. #line 419 "grammar.y" /* yacc.c:1646 */
  1972. {
  1973. (yyval.blk).b = gen_ecode(cstate, (yyvsp[0].e), (yyval.blk).q = (yyvsp[-1].blk).q);
  1974. /*
  1975. * $1 was allocated by "pcap_ether_aton()",
  1976. * so we must free it now that we're done
  1977. * with it.
  1978. */
  1979. free((yyvsp[0].e));
  1980. }
  1981. #line 2220 "grammar.c" /* yacc.c:1646 */
  1982. break;
  1983. case 22:
  1984. #line 428 "grammar.y" /* yacc.c:1646 */
  1985. {
  1986. (yyval.blk).b = gen_acode(cstate, (yyvsp[0].e), (yyval.blk).q = (yyvsp[-1].blk).q);
  1987. /*
  1988. * $1 was allocated by "pcap_ether_aton()",
  1989. * so we must free it now that we're done
  1990. * with it.
  1991. */
  1992. free((yyvsp[0].e));
  1993. }
  1994. #line 2234 "grammar.c" /* yacc.c:1646 */
  1995. break;
  1996. case 23:
  1997. #line 437 "grammar.y" /* yacc.c:1646 */
  1998. { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  1999. #line 2240 "grammar.c" /* yacc.c:1646 */
  2000. break;
  2001. case 24:
  2002. #line 439 "grammar.y" /* yacc.c:1646 */
  2003. { (yyval.blk) = (yyvsp[-1].blk); }
  2004. #line 2246 "grammar.c" /* yacc.c:1646 */
  2005. break;
  2006. case 25:
  2007. #line 441 "grammar.y" /* yacc.c:1646 */
  2008. { (yyval.blk) = (yyvsp[-1].blk); }
  2009. #line 2252 "grammar.c" /* yacc.c:1646 */
  2010. break;
  2011. case 27:
  2012. #line 444 "grammar.y" /* yacc.c:1646 */
  2013. { gen_and((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  2014. #line 2258 "grammar.c" /* yacc.c:1646 */
  2015. break;
  2016. case 28:
  2017. #line 445 "grammar.y" /* yacc.c:1646 */
  2018. { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  2019. #line 2264 "grammar.c" /* yacc.c:1646 */
  2020. break;
  2021. case 29:
  2022. #line 447 "grammar.y" /* yacc.c:1646 */
  2023. { (yyval.blk).b = gen_ncode(cstate, NULL, (bpf_u_int32)(yyvsp[0].i),
  2024. (yyval.blk).q = (yyvsp[-1].blk).q); }
  2025. #line 2271 "grammar.c" /* yacc.c:1646 */
  2026. break;
  2027. case 32:
  2028. #line 452 "grammar.y" /* yacc.c:1646 */
  2029. { gen_not((yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  2030. #line 2277 "grammar.c" /* yacc.c:1646 */
  2031. break;
  2032. case 33:
  2033. #line 454 "grammar.y" /* yacc.c:1646 */
  2034. { QSET((yyval.blk).q, (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); }
  2035. #line 2283 "grammar.c" /* yacc.c:1646 */
  2036. break;
  2037. case 34:
  2038. #line 455 "grammar.y" /* yacc.c:1646 */
  2039. { QSET((yyval.blk).q, (yyvsp[-1].i), (yyvsp[0].i), Q_DEFAULT); }
  2040. #line 2289 "grammar.c" /* yacc.c:1646 */
  2041. break;
  2042. case 35:
  2043. #line 456 "grammar.y" /* yacc.c:1646 */
  2044. { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
  2045. #line 2295 "grammar.c" /* yacc.c:1646 */
  2046. break;
  2047. case 36:
  2048. #line 457 "grammar.y" /* yacc.c:1646 */
  2049. { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTO); }
  2050. #line 2301 "grammar.c" /* yacc.c:1646 */
  2051. break;
  2052. case 37:
  2053. #line 458 "grammar.y" /* yacc.c:1646 */
  2054. { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, Q_PROTOCHAIN); }
  2055. #line 2307 "grammar.c" /* yacc.c:1646 */
  2056. break;
  2057. case 38:
  2058. #line 459 "grammar.y" /* yacc.c:1646 */
  2059. { QSET((yyval.blk).q, (yyvsp[-1].i), Q_DEFAULT, (yyvsp[0].i)); }
  2060. #line 2313 "grammar.c" /* yacc.c:1646 */
  2061. break;
  2062. case 39:
  2063. #line 461 "grammar.y" /* yacc.c:1646 */
  2064. { (yyval.blk) = (yyvsp[0].blk); }
  2065. #line 2319 "grammar.c" /* yacc.c:1646 */
  2066. break;
  2067. case 40:
  2068. #line 462 "grammar.y" /* yacc.c:1646 */
  2069. { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = (yyvsp[-2].blk).q; }
  2070. #line 2325 "grammar.c" /* yacc.c:1646 */
  2071. break;
  2072. case 41:
  2073. #line 463 "grammar.y" /* yacc.c:1646 */
  2074. { (yyval.blk).b = gen_proto_abbrev(cstate, (yyvsp[0].i)); (yyval.blk).q = qerr; }
  2075. #line 2331 "grammar.c" /* yacc.c:1646 */
  2076. break;
  2077. case 42:
  2078. #line 464 "grammar.y" /* yacc.c:1646 */
  2079. { (yyval.blk).b = gen_relation(cstate, (yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 0);
  2080. (yyval.blk).q = qerr; }
  2081. #line 2338 "grammar.c" /* yacc.c:1646 */
  2082. break;
  2083. case 43:
  2084. #line 466 "grammar.y" /* yacc.c:1646 */
  2085. { (yyval.blk).b = gen_relation(cstate, (yyvsp[-1].i), (yyvsp[-2].a), (yyvsp[0].a), 1);
  2086. (yyval.blk).q = qerr; }
  2087. #line 2345 "grammar.c" /* yacc.c:1646 */
  2088. break;
  2089. case 44:
  2090. #line 468 "grammar.y" /* yacc.c:1646 */
  2091. { (yyval.blk).b = (yyvsp[0].rblk); (yyval.blk).q = qerr; }
  2092. #line 2351 "grammar.c" /* yacc.c:1646 */
  2093. break;
  2094. case 45:
  2095. #line 469 "grammar.y" /* yacc.c:1646 */
  2096. { (yyval.blk).b = gen_atmtype_abbrev(cstate, (yyvsp[0].i)); (yyval.blk).q = qerr; }
  2097. #line 2357 "grammar.c" /* yacc.c:1646 */
  2098. break;
  2099. case 46:
  2100. #line 470 "grammar.y" /* yacc.c:1646 */
  2101. { (yyval.blk).b = gen_atmmulti_abbrev(cstate, (yyvsp[0].i)); (yyval.blk).q = qerr; }
  2102. #line 2363 "grammar.c" /* yacc.c:1646 */
  2103. break;
  2104. case 47:
  2105. #line 471 "grammar.y" /* yacc.c:1646 */
  2106. { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
  2107. #line 2369 "grammar.c" /* yacc.c:1646 */
  2108. break;
  2109. case 48:
  2110. #line 472 "grammar.y" /* yacc.c:1646 */
  2111. { (yyval.blk).b = gen_mtp2type_abbrev(cstate, (yyvsp[0].i)); (yyval.blk).q = qerr; }
  2112. #line 2375 "grammar.c" /* yacc.c:1646 */
  2113. break;
  2114. case 49:
  2115. #line 473 "grammar.y" /* yacc.c:1646 */
  2116. { (yyval.blk).b = (yyvsp[0].blk).b; (yyval.blk).q = qerr; }
  2117. #line 2381 "grammar.c" /* yacc.c:1646 */
  2118. break;
  2119. case 51:
  2120. #line 477 "grammar.y" /* yacc.c:1646 */
  2121. { (yyval.i) = Q_DEFAULT; }
  2122. #line 2387 "grammar.c" /* yacc.c:1646 */
  2123. break;
  2124. case 52:
  2125. #line 480 "grammar.y" /* yacc.c:1646 */
  2126. { (yyval.i) = Q_SRC; }
  2127. #line 2393 "grammar.c" /* yacc.c:1646 */
  2128. break;
  2129. case 53:
  2130. #line 481 "grammar.y" /* yacc.c:1646 */
  2131. { (yyval.i) = Q_DST; }
  2132. #line 2399 "grammar.c" /* yacc.c:1646 */
  2133. break;
  2134. case 54:
  2135. #line 482 "grammar.y" /* yacc.c:1646 */
  2136. { (yyval.i) = Q_OR; }
  2137. #line 2405 "grammar.c" /* yacc.c:1646 */
  2138. break;
  2139. case 55:
  2140. #line 483 "grammar.y" /* yacc.c:1646 */
  2141. { (yyval.i) = Q_OR; }
  2142. #line 2411 "grammar.c" /* yacc.c:1646 */
  2143. break;
  2144. case 56:
  2145. #line 484 "grammar.y" /* yacc.c:1646 */
  2146. { (yyval.i) = Q_AND; }
  2147. #line 2417 "grammar.c" /* yacc.c:1646 */
  2148. break;
  2149. case 57:
  2150. #line 485 "grammar.y" /* yacc.c:1646 */
  2151. { (yyval.i) = Q_AND; }
  2152. #line 2423 "grammar.c" /* yacc.c:1646 */
  2153. break;
  2154. case 58:
  2155. #line 486 "grammar.y" /* yacc.c:1646 */
  2156. { (yyval.i) = Q_ADDR1; }
  2157. #line 2429 "grammar.c" /* yacc.c:1646 */
  2158. break;
  2159. case 59:
  2160. #line 487 "grammar.y" /* yacc.c:1646 */
  2161. { (yyval.i) = Q_ADDR2; }
  2162. #line 2435 "grammar.c" /* yacc.c:1646 */
  2163. break;
  2164. case 60:
  2165. #line 488 "grammar.y" /* yacc.c:1646 */
  2166. { (yyval.i) = Q_ADDR3; }
  2167. #line 2441 "grammar.c" /* yacc.c:1646 */
  2168. break;
  2169. case 61:
  2170. #line 489 "grammar.y" /* yacc.c:1646 */
  2171. { (yyval.i) = Q_ADDR4; }
  2172. #line 2447 "grammar.c" /* yacc.c:1646 */
  2173. break;
  2174. case 62:
  2175. #line 490 "grammar.y" /* yacc.c:1646 */
  2176. { (yyval.i) = Q_RA; }
  2177. #line 2453 "grammar.c" /* yacc.c:1646 */
  2178. break;
  2179. case 63:
  2180. #line 491 "grammar.y" /* yacc.c:1646 */
  2181. { (yyval.i) = Q_TA; }
  2182. #line 2459 "grammar.c" /* yacc.c:1646 */
  2183. break;
  2184. case 64:
  2185. #line 494 "grammar.y" /* yacc.c:1646 */
  2186. { (yyval.i) = Q_HOST; }
  2187. #line 2465 "grammar.c" /* yacc.c:1646 */
  2188. break;
  2189. case 65:
  2190. #line 495 "grammar.y" /* yacc.c:1646 */
  2191. { (yyval.i) = Q_NET; }
  2192. #line 2471 "grammar.c" /* yacc.c:1646 */
  2193. break;
  2194. case 66:
  2195. #line 496 "grammar.y" /* yacc.c:1646 */
  2196. { (yyval.i) = Q_PORT; }
  2197. #line 2477 "grammar.c" /* yacc.c:1646 */
  2198. break;
  2199. case 67:
  2200. #line 497 "grammar.y" /* yacc.c:1646 */
  2201. { (yyval.i) = Q_PORTRANGE; }
  2202. #line 2483 "grammar.c" /* yacc.c:1646 */
  2203. break;
  2204. case 68:
  2205. #line 500 "grammar.y" /* yacc.c:1646 */
  2206. { (yyval.i) = Q_GATEWAY; }
  2207. #line 2489 "grammar.c" /* yacc.c:1646 */
  2208. break;
  2209. case 69:
  2210. #line 502 "grammar.y" /* yacc.c:1646 */
  2211. { (yyval.i) = Q_LINK; }
  2212. #line 2495 "grammar.c" /* yacc.c:1646 */
  2213. break;
  2214. case 70:
  2215. #line 503 "grammar.y" /* yacc.c:1646 */
  2216. { (yyval.i) = Q_IP; }
  2217. #line 2501 "grammar.c" /* yacc.c:1646 */
  2218. break;
  2219. case 71:
  2220. #line 504 "grammar.y" /* yacc.c:1646 */
  2221. { (yyval.i) = Q_ARP; }
  2222. #line 2507 "grammar.c" /* yacc.c:1646 */
  2223. break;
  2224. case 72:
  2225. #line 505 "grammar.y" /* yacc.c:1646 */
  2226. { (yyval.i) = Q_RARP; }
  2227. #line 2513 "grammar.c" /* yacc.c:1646 */
  2228. break;
  2229. case 73:
  2230. #line 506 "grammar.y" /* yacc.c:1646 */
  2231. { (yyval.i) = Q_SCTP; }
  2232. #line 2519 "grammar.c" /* yacc.c:1646 */
  2233. break;
  2234. case 74:
  2235. #line 507 "grammar.y" /* yacc.c:1646 */
  2236. { (yyval.i) = Q_TCP; }
  2237. #line 2525 "grammar.c" /* yacc.c:1646 */
  2238. break;
  2239. case 75:
  2240. #line 508 "grammar.y" /* yacc.c:1646 */
  2241. { (yyval.i) = Q_UDP; }
  2242. #line 2531 "grammar.c" /* yacc.c:1646 */
  2243. break;
  2244. case 76:
  2245. #line 509 "grammar.y" /* yacc.c:1646 */
  2246. { (yyval.i) = Q_ICMP; }
  2247. #line 2537 "grammar.c" /* yacc.c:1646 */
  2248. break;
  2249. case 77:
  2250. #line 510 "grammar.y" /* yacc.c:1646 */
  2251. { (yyval.i) = Q_IGMP; }
  2252. #line 2543 "grammar.c" /* yacc.c:1646 */
  2253. break;
  2254. case 78:
  2255. #line 511 "grammar.y" /* yacc.c:1646 */
  2256. { (yyval.i) = Q_IGRP; }
  2257. #line 2549 "grammar.c" /* yacc.c:1646 */
  2258. break;
  2259. case 79:
  2260. #line 512 "grammar.y" /* yacc.c:1646 */
  2261. { (yyval.i) = Q_PIM; }
  2262. #line 2555 "grammar.c" /* yacc.c:1646 */
  2263. break;
  2264. case 80:
  2265. #line 513 "grammar.y" /* yacc.c:1646 */
  2266. { (yyval.i) = Q_VRRP; }
  2267. #line 2561 "grammar.c" /* yacc.c:1646 */
  2268. break;
  2269. case 81:
  2270. #line 514 "grammar.y" /* yacc.c:1646 */
  2271. { (yyval.i) = Q_CARP; }
  2272. #line 2567 "grammar.c" /* yacc.c:1646 */
  2273. break;
  2274. case 82:
  2275. #line 515 "grammar.y" /* yacc.c:1646 */
  2276. { (yyval.i) = Q_ATALK; }
  2277. #line 2573 "grammar.c" /* yacc.c:1646 */
  2278. break;
  2279. case 83:
  2280. #line 516 "grammar.y" /* yacc.c:1646 */
  2281. { (yyval.i) = Q_AARP; }
  2282. #line 2579 "grammar.c" /* yacc.c:1646 */
  2283. break;
  2284. case 84:
  2285. #line 517 "grammar.y" /* yacc.c:1646 */
  2286. { (yyval.i) = Q_DECNET; }
  2287. #line 2585 "grammar.c" /* yacc.c:1646 */
  2288. break;
  2289. case 85:
  2290. #line 518 "grammar.y" /* yacc.c:1646 */
  2291. { (yyval.i) = Q_LAT; }
  2292. #line 2591 "grammar.c" /* yacc.c:1646 */
  2293. break;
  2294. case 86:
  2295. #line 519 "grammar.y" /* yacc.c:1646 */
  2296. { (yyval.i) = Q_SCA; }
  2297. #line 2597 "grammar.c" /* yacc.c:1646 */
  2298. break;
  2299. case 87:
  2300. #line 520 "grammar.y" /* yacc.c:1646 */
  2301. { (yyval.i) = Q_MOPDL; }
  2302. #line 2603 "grammar.c" /* yacc.c:1646 */
  2303. break;
  2304. case 88:
  2305. #line 521 "grammar.y" /* yacc.c:1646 */
  2306. { (yyval.i) = Q_MOPRC; }
  2307. #line 2609 "grammar.c" /* yacc.c:1646 */
  2308. break;
  2309. case 89:
  2310. #line 522 "grammar.y" /* yacc.c:1646 */
  2311. { (yyval.i) = Q_IPV6; }
  2312. #line 2615 "grammar.c" /* yacc.c:1646 */
  2313. break;
  2314. case 90:
  2315. #line 523 "grammar.y" /* yacc.c:1646 */
  2316. { (yyval.i) = Q_ICMPV6; }
  2317. #line 2621 "grammar.c" /* yacc.c:1646 */
  2318. break;
  2319. case 91:
  2320. #line 524 "grammar.y" /* yacc.c:1646 */
  2321. { (yyval.i) = Q_AH; }
  2322. #line 2627 "grammar.c" /* yacc.c:1646 */
  2323. break;
  2324. case 92:
  2325. #line 525 "grammar.y" /* yacc.c:1646 */
  2326. { (yyval.i) = Q_ESP; }
  2327. #line 2633 "grammar.c" /* yacc.c:1646 */
  2328. break;
  2329. case 93:
  2330. #line 526 "grammar.y" /* yacc.c:1646 */
  2331. { (yyval.i) = Q_ISO; }
  2332. #line 2639 "grammar.c" /* yacc.c:1646 */
  2333. break;
  2334. case 94:
  2335. #line 527 "grammar.y" /* yacc.c:1646 */
  2336. { (yyval.i) = Q_ESIS; }
  2337. #line 2645 "grammar.c" /* yacc.c:1646 */
  2338. break;
  2339. case 95:
  2340. #line 528 "grammar.y" /* yacc.c:1646 */
  2341. { (yyval.i) = Q_ISIS; }
  2342. #line 2651 "grammar.c" /* yacc.c:1646 */
  2343. break;
  2344. case 96:
  2345. #line 529 "grammar.y" /* yacc.c:1646 */
  2346. { (yyval.i) = Q_ISIS_L1; }
  2347. #line 2657 "grammar.c" /* yacc.c:1646 */
  2348. break;
  2349. case 97:
  2350. #line 530 "grammar.y" /* yacc.c:1646 */
  2351. { (yyval.i) = Q_ISIS_L2; }
  2352. #line 2663 "grammar.c" /* yacc.c:1646 */
  2353. break;
  2354. case 98:
  2355. #line 531 "grammar.y" /* yacc.c:1646 */
  2356. { (yyval.i) = Q_ISIS_IIH; }
  2357. #line 2669 "grammar.c" /* yacc.c:1646 */
  2358. break;
  2359. case 99:
  2360. #line 532 "grammar.y" /* yacc.c:1646 */
  2361. { (yyval.i) = Q_ISIS_LSP; }
  2362. #line 2675 "grammar.c" /* yacc.c:1646 */
  2363. break;
  2364. case 100:
  2365. #line 533 "grammar.y" /* yacc.c:1646 */
  2366. { (yyval.i) = Q_ISIS_SNP; }
  2367. #line 2681 "grammar.c" /* yacc.c:1646 */
  2368. break;
  2369. case 101:
  2370. #line 534 "grammar.y" /* yacc.c:1646 */
  2371. { (yyval.i) = Q_ISIS_PSNP; }
  2372. #line 2687 "grammar.c" /* yacc.c:1646 */
  2373. break;
  2374. case 102:
  2375. #line 535 "grammar.y" /* yacc.c:1646 */
  2376. { (yyval.i) = Q_ISIS_CSNP; }
  2377. #line 2693 "grammar.c" /* yacc.c:1646 */
  2378. break;
  2379. case 103:
  2380. #line 536 "grammar.y" /* yacc.c:1646 */
  2381. { (yyval.i) = Q_CLNP; }
  2382. #line 2699 "grammar.c" /* yacc.c:1646 */
  2383. break;
  2384. case 104:
  2385. #line 537 "grammar.y" /* yacc.c:1646 */
  2386. { (yyval.i) = Q_STP; }
  2387. #line 2705 "grammar.c" /* yacc.c:1646 */
  2388. break;
  2389. case 105:
  2390. #line 538 "grammar.y" /* yacc.c:1646 */
  2391. { (yyval.i) = Q_IPX; }
  2392. #line 2711 "grammar.c" /* yacc.c:1646 */
  2393. break;
  2394. case 106:
  2395. #line 539 "grammar.y" /* yacc.c:1646 */
  2396. { (yyval.i) = Q_NETBEUI; }
  2397. #line 2717 "grammar.c" /* yacc.c:1646 */
  2398. break;
  2399. case 107:
  2400. #line 540 "grammar.y" /* yacc.c:1646 */
  2401. { (yyval.i) = Q_RADIO; }
  2402. #line 2723 "grammar.c" /* yacc.c:1646 */
  2403. break;
  2404. case 108:
  2405. #line 542 "grammar.y" /* yacc.c:1646 */
  2406. { (yyval.rblk) = gen_broadcast(cstate, (yyvsp[-1].i)); }
  2407. #line 2729 "grammar.c" /* yacc.c:1646 */
  2408. break;
  2409. case 109:
  2410. #line 543 "grammar.y" /* yacc.c:1646 */
  2411. { (yyval.rblk) = gen_multicast(cstate, (yyvsp[-1].i)); }
  2412. #line 2735 "grammar.c" /* yacc.c:1646 */
  2413. break;
  2414. case 110:
  2415. #line 544 "grammar.y" /* yacc.c:1646 */
  2416. { (yyval.rblk) = gen_less(cstate, (yyvsp[0].i)); }
  2417. #line 2741 "grammar.c" /* yacc.c:1646 */
  2418. break;
  2419. case 111:
  2420. #line 545 "grammar.y" /* yacc.c:1646 */
  2421. { (yyval.rblk) = gen_greater(cstate, (yyvsp[0].i)); }
  2422. #line 2747 "grammar.c" /* yacc.c:1646 */
  2423. break;
  2424. case 112:
  2425. #line 546 "grammar.y" /* yacc.c:1646 */
  2426. { (yyval.rblk) = gen_byteop(cstate, (yyvsp[-1].i), (yyvsp[-2].i), (yyvsp[0].i)); }
  2427. #line 2753 "grammar.c" /* yacc.c:1646 */
  2428. break;
  2429. case 113:
  2430. #line 547 "grammar.y" /* yacc.c:1646 */
  2431. { (yyval.rblk) = gen_inbound(cstate, 0); }
  2432. #line 2759 "grammar.c" /* yacc.c:1646 */
  2433. break;
  2434. case 114:
  2435. #line 548 "grammar.y" /* yacc.c:1646 */
  2436. { (yyval.rblk) = gen_inbound(cstate, 1); }
  2437. #line 2765 "grammar.c" /* yacc.c:1646 */
  2438. break;
  2439. case 115:
  2440. #line 549 "grammar.y" /* yacc.c:1646 */
  2441. { (yyval.rblk) = gen_vlan(cstate, (yyvsp[0].i)); }
  2442. #line 2771 "grammar.c" /* yacc.c:1646 */
  2443. break;
  2444. case 116:
  2445. #line 550 "grammar.y" /* yacc.c:1646 */
  2446. { (yyval.rblk) = gen_vlan(cstate, -1); }
  2447. #line 2777 "grammar.c" /* yacc.c:1646 */
  2448. break;
  2449. case 117:
  2450. #line 551 "grammar.y" /* yacc.c:1646 */
  2451. { (yyval.rblk) = gen_mpls(cstate, (yyvsp[0].i)); }
  2452. #line 2783 "grammar.c" /* yacc.c:1646 */
  2453. break;
  2454. case 118:
  2455. #line 552 "grammar.y" /* yacc.c:1646 */
  2456. { (yyval.rblk) = gen_mpls(cstate, -1); }
  2457. #line 2789 "grammar.c" /* yacc.c:1646 */
  2458. break;
  2459. case 119:
  2460. #line 553 "grammar.y" /* yacc.c:1646 */
  2461. { (yyval.rblk) = gen_pppoed(cstate); }
  2462. #line 2795 "grammar.c" /* yacc.c:1646 */
  2463. break;
  2464. case 120:
  2465. #line 554 "grammar.y" /* yacc.c:1646 */
  2466. { (yyval.rblk) = gen_pppoes(cstate, (yyvsp[0].i)); }
  2467. #line 2801 "grammar.c" /* yacc.c:1646 */
  2468. break;
  2469. case 121:
  2470. #line 555 "grammar.y" /* yacc.c:1646 */
  2471. { (yyval.rblk) = gen_pppoes(cstate, -1); }
  2472. #line 2807 "grammar.c" /* yacc.c:1646 */
  2473. break;
  2474. case 122:
  2475. #line 556 "grammar.y" /* yacc.c:1646 */
  2476. { (yyval.rblk) = gen_geneve(cstate, (yyvsp[0].i)); }
  2477. #line 2813 "grammar.c" /* yacc.c:1646 */
  2478. break;
  2479. case 123:
  2480. #line 557 "grammar.y" /* yacc.c:1646 */
  2481. { (yyval.rblk) = gen_geneve(cstate, -1); }
  2482. #line 2819 "grammar.c" /* yacc.c:1646 */
  2483. break;
  2484. case 124:
  2485. #line 558 "grammar.y" /* yacc.c:1646 */
  2486. { (yyval.rblk) = (yyvsp[0].rblk); }
  2487. #line 2825 "grammar.c" /* yacc.c:1646 */
  2488. break;
  2489. case 125:
  2490. #line 559 "grammar.y" /* yacc.c:1646 */
  2491. { (yyval.rblk) = (yyvsp[0].rblk); }
  2492. #line 2831 "grammar.c" /* yacc.c:1646 */
  2493. break;
  2494. case 126:
  2495. #line 560 "grammar.y" /* yacc.c:1646 */
  2496. { (yyval.rblk) = (yyvsp[0].rblk); }
  2497. #line 2837 "grammar.c" /* yacc.c:1646 */
  2498. break;
  2499. case 127:
  2500. #line 563 "grammar.y" /* yacc.c:1646 */
  2501. { (yyval.rblk) = gen_pf_ifname(cstate, (yyvsp[0].s)); }
  2502. #line 2843 "grammar.c" /* yacc.c:1646 */
  2503. break;
  2504. case 128:
  2505. #line 564 "grammar.y" /* yacc.c:1646 */
  2506. { (yyval.rblk) = gen_pf_ruleset(cstate, (yyvsp[0].s)); }
  2507. #line 2849 "grammar.c" /* yacc.c:1646 */
  2508. break;
  2509. case 129:
  2510. #line 565 "grammar.y" /* yacc.c:1646 */
  2511. { (yyval.rblk) = gen_pf_rnr(cstate, (yyvsp[0].i)); }
  2512. #line 2855 "grammar.c" /* yacc.c:1646 */
  2513. break;
  2514. case 130:
  2515. #line 566 "grammar.y" /* yacc.c:1646 */
  2516. { (yyval.rblk) = gen_pf_srnr(cstate, (yyvsp[0].i)); }
  2517. #line 2861 "grammar.c" /* yacc.c:1646 */
  2518. break;
  2519. case 131:
  2520. #line 567 "grammar.y" /* yacc.c:1646 */
  2521. { (yyval.rblk) = gen_pf_reason(cstate, (yyvsp[0].i)); }
  2522. #line 2867 "grammar.c" /* yacc.c:1646 */
  2523. break;
  2524. case 132:
  2525. #line 568 "grammar.y" /* yacc.c:1646 */
  2526. { (yyval.rblk) = gen_pf_action(cstate, (yyvsp[0].i)); }
  2527. #line 2873 "grammar.c" /* yacc.c:1646 */
  2528. break;
  2529. case 133:
  2530. #line 572 "grammar.y" /* yacc.c:1646 */
  2531. { (yyval.rblk) = gen_p80211_type(cstate, (yyvsp[-2].i) | (yyvsp[0].i),
  2532. IEEE80211_FC0_TYPE_MASK |
  2533. IEEE80211_FC0_SUBTYPE_MASK);
  2534. }
  2535. #line 2882 "grammar.c" /* yacc.c:1646 */
  2536. break;
  2537. case 134:
  2538. #line 576 "grammar.y" /* yacc.c:1646 */
  2539. { (yyval.rblk) = gen_p80211_type(cstate, (yyvsp[0].i),
  2540. IEEE80211_FC0_TYPE_MASK);
  2541. }
  2542. #line 2890 "grammar.c" /* yacc.c:1646 */
  2543. break;
  2544. case 135:
  2545. #line 579 "grammar.y" /* yacc.c:1646 */
  2546. { (yyval.rblk) = gen_p80211_type(cstate, (yyvsp[0].i),
  2547. IEEE80211_FC0_TYPE_MASK |
  2548. IEEE80211_FC0_SUBTYPE_MASK);
  2549. }
  2550. #line 2899 "grammar.c" /* yacc.c:1646 */
  2551. break;
  2552. case 136:
  2553. #line 583 "grammar.y" /* yacc.c:1646 */
  2554. { (yyval.rblk) = gen_p80211_fcdir(cstate, (yyvsp[0].i)); }
  2555. #line 2905 "grammar.c" /* yacc.c:1646 */
  2556. break;
  2557. case 138:
  2558. #line 587 "grammar.y" /* yacc.c:1646 */
  2559. { (yyval.i) = str2tok((yyvsp[0].s), ieee80211_types);
  2560. if ((yyval.i) == -1)
  2561. bpf_error(cstate, "unknown 802.11 type name");
  2562. }
  2563. #line 2914 "grammar.c" /* yacc.c:1646 */
  2564. break;
  2565. case 140:
  2566. #line 594 "grammar.y" /* yacc.c:1646 */
  2567. { const struct tok *types = NULL;
  2568. int i;
  2569. for (i = 0;; i++) {
  2570. if (ieee80211_type_subtypes[i].tok == NULL) {
  2571. /* Ran out of types */
  2572. bpf_error(cstate, "unknown 802.11 type");
  2573. break;
  2574. }
  2575. if ((yyvsp[(-1) - (1)].i) == ieee80211_type_subtypes[i].type) {
  2576. types = ieee80211_type_subtypes[i].tok;
  2577. break;
  2578. }
  2579. }
  2580. (yyval.i) = str2tok((yyvsp[0].s), types);
  2581. if ((yyval.i) == -1)
  2582. bpf_error(cstate, "unknown 802.11 subtype name");
  2583. }
  2584. #line 2937 "grammar.c" /* yacc.c:1646 */
  2585. break;
  2586. case 141:
  2587. #line 614 "grammar.y" /* yacc.c:1646 */
  2588. { int i;
  2589. for (i = 0;; i++) {
  2590. if (ieee80211_type_subtypes[i].tok == NULL) {
  2591. /* Ran out of types */
  2592. bpf_error(cstate, "unknown 802.11 type name");
  2593. break;
  2594. }
  2595. (yyval.i) = str2tok((yyvsp[0].s), ieee80211_type_subtypes[i].tok);
  2596. if ((yyval.i) != -1) {
  2597. (yyval.i) |= ieee80211_type_subtypes[i].type;
  2598. break;
  2599. }
  2600. }
  2601. }
  2602. #line 2956 "grammar.c" /* yacc.c:1646 */
  2603. break;
  2604. case 142:
  2605. #line 630 "grammar.y" /* yacc.c:1646 */
  2606. { (yyval.rblk) = gen_llc(cstate); }
  2607. #line 2962 "grammar.c" /* yacc.c:1646 */
  2608. break;
  2609. case 143:
  2610. #line 631 "grammar.y" /* yacc.c:1646 */
  2611. { if (pcap_strcasecmp((yyvsp[0].s), "i") == 0)
  2612. (yyval.rblk) = gen_llc_i(cstate);
  2613. else if (pcap_strcasecmp((yyvsp[0].s), "s") == 0)
  2614. (yyval.rblk) = gen_llc_s(cstate);
  2615. else if (pcap_strcasecmp((yyvsp[0].s), "u") == 0)
  2616. (yyval.rblk) = gen_llc_u(cstate);
  2617. else {
  2618. int subtype;
  2619. subtype = str2tok((yyvsp[0].s), llc_s_subtypes);
  2620. if (subtype != -1)
  2621. (yyval.rblk) = gen_llc_s_subtype(cstate, subtype);
  2622. else {
  2623. subtype = str2tok((yyvsp[0].s), llc_u_subtypes);
  2624. if (subtype == -1)
  2625. bpf_error(cstate, "unknown LLC type name \"%s\"", (yyvsp[0].s));
  2626. (yyval.rblk) = gen_llc_u_subtype(cstate, subtype);
  2627. }
  2628. }
  2629. }
  2630. #line 2987 "grammar.c" /* yacc.c:1646 */
  2631. break;
  2632. case 144:
  2633. #line 652 "grammar.y" /* yacc.c:1646 */
  2634. { (yyval.rblk) = gen_llc_s_subtype(cstate, LLC_RNR); }
  2635. #line 2993 "grammar.c" /* yacc.c:1646 */
  2636. break;
  2637. case 146:
  2638. #line 656 "grammar.y" /* yacc.c:1646 */
  2639. { if (pcap_strcasecmp((yyvsp[0].s), "nods") == 0)
  2640. (yyval.i) = IEEE80211_FC1_DIR_NODS;
  2641. else if (pcap_strcasecmp((yyvsp[0].s), "tods") == 0)
  2642. (yyval.i) = IEEE80211_FC1_DIR_TODS;
  2643. else if (pcap_strcasecmp((yyvsp[0].s), "fromds") == 0)
  2644. (yyval.i) = IEEE80211_FC1_DIR_FROMDS;
  2645. else if (pcap_strcasecmp((yyvsp[0].s), "dstods") == 0)
  2646. (yyval.i) = IEEE80211_FC1_DIR_DSTODS;
  2647. else
  2648. bpf_error(cstate, "unknown 802.11 direction");
  2649. }
  2650. #line 3009 "grammar.c" /* yacc.c:1646 */
  2651. break;
  2652. case 147:
  2653. #line 669 "grammar.y" /* yacc.c:1646 */
  2654. { (yyval.i) = (yyvsp[0].i); }
  2655. #line 3015 "grammar.c" /* yacc.c:1646 */
  2656. break;
  2657. case 148:
  2658. #line 670 "grammar.y" /* yacc.c:1646 */
  2659. { (yyval.i) = pfreason_to_num(cstate, (yyvsp[0].s)); }
  2660. #line 3021 "grammar.c" /* yacc.c:1646 */
  2661. break;
  2662. case 149:
  2663. #line 673 "grammar.y" /* yacc.c:1646 */
  2664. { (yyval.i) = pfaction_to_num(cstate, (yyvsp[0].s)); }
  2665. #line 3027 "grammar.c" /* yacc.c:1646 */
  2666. break;
  2667. case 150:
  2668. #line 676 "grammar.y" /* yacc.c:1646 */
  2669. { (yyval.i) = BPF_JGT; }
  2670. #line 3033 "grammar.c" /* yacc.c:1646 */
  2671. break;
  2672. case 151:
  2673. #line 677 "grammar.y" /* yacc.c:1646 */
  2674. { (yyval.i) = BPF_JGE; }
  2675. #line 3039 "grammar.c" /* yacc.c:1646 */
  2676. break;
  2677. case 152:
  2678. #line 678 "grammar.y" /* yacc.c:1646 */
  2679. { (yyval.i) = BPF_JEQ; }
  2680. #line 3045 "grammar.c" /* yacc.c:1646 */
  2681. break;
  2682. case 153:
  2683. #line 680 "grammar.y" /* yacc.c:1646 */
  2684. { (yyval.i) = BPF_JGT; }
  2685. #line 3051 "grammar.c" /* yacc.c:1646 */
  2686. break;
  2687. case 154:
  2688. #line 681 "grammar.y" /* yacc.c:1646 */
  2689. { (yyval.i) = BPF_JGE; }
  2690. #line 3057 "grammar.c" /* yacc.c:1646 */
  2691. break;
  2692. case 155:
  2693. #line 682 "grammar.y" /* yacc.c:1646 */
  2694. { (yyval.i) = BPF_JEQ; }
  2695. #line 3063 "grammar.c" /* yacc.c:1646 */
  2696. break;
  2697. case 156:
  2698. #line 684 "grammar.y" /* yacc.c:1646 */
  2699. { (yyval.a) = gen_loadi(cstate, (yyvsp[0].i)); }
  2700. #line 3069 "grammar.c" /* yacc.c:1646 */
  2701. break;
  2702. case 158:
  2703. #line 687 "grammar.y" /* yacc.c:1646 */
  2704. { (yyval.a) = gen_load(cstate, (yyvsp[-3].i), (yyvsp[-1].a), 1); }
  2705. #line 3075 "grammar.c" /* yacc.c:1646 */
  2706. break;
  2707. case 159:
  2708. #line 688 "grammar.y" /* yacc.c:1646 */
  2709. { (yyval.a) = gen_load(cstate, (yyvsp[-5].i), (yyvsp[-3].a), (yyvsp[-1].i)); }
  2710. #line 3081 "grammar.c" /* yacc.c:1646 */
  2711. break;
  2712. case 160:
  2713. #line 689 "grammar.y" /* yacc.c:1646 */
  2714. { (yyval.a) = gen_arth(cstate, BPF_ADD, (yyvsp[-2].a), (yyvsp[0].a)); }
  2715. #line 3087 "grammar.c" /* yacc.c:1646 */
  2716. break;
  2717. case 161:
  2718. #line 690 "grammar.y" /* yacc.c:1646 */
  2719. { (yyval.a) = gen_arth(cstate, BPF_SUB, (yyvsp[-2].a), (yyvsp[0].a)); }
  2720. #line 3093 "grammar.c" /* yacc.c:1646 */
  2721. break;
  2722. case 162:
  2723. #line 691 "grammar.y" /* yacc.c:1646 */
  2724. { (yyval.a) = gen_arth(cstate, BPF_MUL, (yyvsp[-2].a), (yyvsp[0].a)); }
  2725. #line 3099 "grammar.c" /* yacc.c:1646 */
  2726. break;
  2727. case 163:
  2728. #line 692 "grammar.y" /* yacc.c:1646 */
  2729. { (yyval.a) = gen_arth(cstate, BPF_DIV, (yyvsp[-2].a), (yyvsp[0].a)); }
  2730. #line 3105 "grammar.c" /* yacc.c:1646 */
  2731. break;
  2732. case 164:
  2733. #line 693 "grammar.y" /* yacc.c:1646 */
  2734. { (yyval.a) = gen_arth(cstate, BPF_MOD, (yyvsp[-2].a), (yyvsp[0].a)); }
  2735. #line 3111 "grammar.c" /* yacc.c:1646 */
  2736. break;
  2737. case 165:
  2738. #line 694 "grammar.y" /* yacc.c:1646 */
  2739. { (yyval.a) = gen_arth(cstate, BPF_AND, (yyvsp[-2].a), (yyvsp[0].a)); }
  2740. #line 3117 "grammar.c" /* yacc.c:1646 */
  2741. break;
  2742. case 166:
  2743. #line 695 "grammar.y" /* yacc.c:1646 */
  2744. { (yyval.a) = gen_arth(cstate, BPF_OR, (yyvsp[-2].a), (yyvsp[0].a)); }
  2745. #line 3123 "grammar.c" /* yacc.c:1646 */
  2746. break;
  2747. case 167:
  2748. #line 696 "grammar.y" /* yacc.c:1646 */
  2749. { (yyval.a) = gen_arth(cstate, BPF_XOR, (yyvsp[-2].a), (yyvsp[0].a)); }
  2750. #line 3129 "grammar.c" /* yacc.c:1646 */
  2751. break;
  2752. case 168:
  2753. #line 697 "grammar.y" /* yacc.c:1646 */
  2754. { (yyval.a) = gen_arth(cstate, BPF_LSH, (yyvsp[-2].a), (yyvsp[0].a)); }
  2755. #line 3135 "grammar.c" /* yacc.c:1646 */
  2756. break;
  2757. case 169:
  2758. #line 698 "grammar.y" /* yacc.c:1646 */
  2759. { (yyval.a) = gen_arth(cstate, BPF_RSH, (yyvsp[-2].a), (yyvsp[0].a)); }
  2760. #line 3141 "grammar.c" /* yacc.c:1646 */
  2761. break;
  2762. case 170:
  2763. #line 699 "grammar.y" /* yacc.c:1646 */
  2764. { (yyval.a) = gen_neg(cstate, (yyvsp[0].a)); }
  2765. #line 3147 "grammar.c" /* yacc.c:1646 */
  2766. break;
  2767. case 171:
  2768. #line 700 "grammar.y" /* yacc.c:1646 */
  2769. { (yyval.a) = (yyvsp[-1].a); }
  2770. #line 3153 "grammar.c" /* yacc.c:1646 */
  2771. break;
  2772. case 172:
  2773. #line 701 "grammar.y" /* yacc.c:1646 */
  2774. { (yyval.a) = gen_loadlen(cstate); }
  2775. #line 3159 "grammar.c" /* yacc.c:1646 */
  2776. break;
  2777. case 173:
  2778. #line 703 "grammar.y" /* yacc.c:1646 */
  2779. { (yyval.i) = '&'; }
  2780. #line 3165 "grammar.c" /* yacc.c:1646 */
  2781. break;
  2782. case 174:
  2783. #line 704 "grammar.y" /* yacc.c:1646 */
  2784. { (yyval.i) = '|'; }
  2785. #line 3171 "grammar.c" /* yacc.c:1646 */
  2786. break;
  2787. case 175:
  2788. #line 705 "grammar.y" /* yacc.c:1646 */
  2789. { (yyval.i) = '<'; }
  2790. #line 3177 "grammar.c" /* yacc.c:1646 */
  2791. break;
  2792. case 176:
  2793. #line 706 "grammar.y" /* yacc.c:1646 */
  2794. { (yyval.i) = '>'; }
  2795. #line 3183 "grammar.c" /* yacc.c:1646 */
  2796. break;
  2797. case 177:
  2798. #line 707 "grammar.y" /* yacc.c:1646 */
  2799. { (yyval.i) = '='; }
  2800. #line 3189 "grammar.c" /* yacc.c:1646 */
  2801. break;
  2802. case 179:
  2803. #line 710 "grammar.y" /* yacc.c:1646 */
  2804. { (yyval.i) = (yyvsp[-1].i); }
  2805. #line 3195 "grammar.c" /* yacc.c:1646 */
  2806. break;
  2807. case 180:
  2808. #line 712 "grammar.y" /* yacc.c:1646 */
  2809. { (yyval.i) = A_LANE; }
  2810. #line 3201 "grammar.c" /* yacc.c:1646 */
  2811. break;
  2812. case 181:
  2813. #line 713 "grammar.y" /* yacc.c:1646 */
  2814. { (yyval.i) = A_METAC; }
  2815. #line 3207 "grammar.c" /* yacc.c:1646 */
  2816. break;
  2817. case 182:
  2818. #line 714 "grammar.y" /* yacc.c:1646 */
  2819. { (yyval.i) = A_BCC; }
  2820. #line 3213 "grammar.c" /* yacc.c:1646 */
  2821. break;
  2822. case 183:
  2823. #line 715 "grammar.y" /* yacc.c:1646 */
  2824. { (yyval.i) = A_OAMF4EC; }
  2825. #line 3219 "grammar.c" /* yacc.c:1646 */
  2826. break;
  2827. case 184:
  2828. #line 716 "grammar.y" /* yacc.c:1646 */
  2829. { (yyval.i) = A_OAMF4SC; }
  2830. #line 3225 "grammar.c" /* yacc.c:1646 */
  2831. break;
  2832. case 185:
  2833. #line 717 "grammar.y" /* yacc.c:1646 */
  2834. { (yyval.i) = A_SC; }
  2835. #line 3231 "grammar.c" /* yacc.c:1646 */
  2836. break;
  2837. case 186:
  2838. #line 718 "grammar.y" /* yacc.c:1646 */
  2839. { (yyval.i) = A_ILMIC; }
  2840. #line 3237 "grammar.c" /* yacc.c:1646 */
  2841. break;
  2842. case 187:
  2843. #line 720 "grammar.y" /* yacc.c:1646 */
  2844. { (yyval.i) = A_OAM; }
  2845. #line 3243 "grammar.c" /* yacc.c:1646 */
  2846. break;
  2847. case 188:
  2848. #line 721 "grammar.y" /* yacc.c:1646 */
  2849. { (yyval.i) = A_OAMF4; }
  2850. #line 3249 "grammar.c" /* yacc.c:1646 */
  2851. break;
  2852. case 189:
  2853. #line 722 "grammar.y" /* yacc.c:1646 */
  2854. { (yyval.i) = A_CONNECTMSG; }
  2855. #line 3255 "grammar.c" /* yacc.c:1646 */
  2856. break;
  2857. case 190:
  2858. #line 723 "grammar.y" /* yacc.c:1646 */
  2859. { (yyval.i) = A_METACONNECT; }
  2860. #line 3261 "grammar.c" /* yacc.c:1646 */
  2861. break;
  2862. case 191:
  2863. #line 726 "grammar.y" /* yacc.c:1646 */
  2864. { (yyval.blk).atmfieldtype = A_VPI; }
  2865. #line 3267 "grammar.c" /* yacc.c:1646 */
  2866. break;
  2867. case 192:
  2868. #line 727 "grammar.y" /* yacc.c:1646 */
  2869. { (yyval.blk).atmfieldtype = A_VCI; }
  2870. #line 3273 "grammar.c" /* yacc.c:1646 */
  2871. break;
  2872. case 194:
  2873. #line 730 "grammar.y" /* yacc.c:1646 */
  2874. { (yyval.blk).b = gen_atmfield_code(cstate, (yyvsp[-2].blk).atmfieldtype, (bpf_int32)(yyvsp[0].i), (bpf_u_int32)(yyvsp[-1].i), 0); }
  2875. #line 3279 "grammar.c" /* yacc.c:1646 */
  2876. break;
  2877. case 195:
  2878. #line 731 "grammar.y" /* yacc.c:1646 */
  2879. { (yyval.blk).b = gen_atmfield_code(cstate, (yyvsp[-2].blk).atmfieldtype, (bpf_int32)(yyvsp[0].i), (bpf_u_int32)(yyvsp[-1].i), 1); }
  2880. #line 3285 "grammar.c" /* yacc.c:1646 */
  2881. break;
  2882. case 196:
  2883. #line 732 "grammar.y" /* yacc.c:1646 */
  2884. { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; }
  2885. #line 3291 "grammar.c" /* yacc.c:1646 */
  2886. break;
  2887. case 197:
  2888. #line 734 "grammar.y" /* yacc.c:1646 */
  2889. {
  2890. (yyval.blk).atmfieldtype = (yyvsp[-1].blk).atmfieldtype;
  2891. if ((yyval.blk).atmfieldtype == A_VPI ||
  2892. (yyval.blk).atmfieldtype == A_VCI)
  2893. (yyval.blk).b = gen_atmfield_code(cstate, (yyval.blk).atmfieldtype, (bpf_int32) (yyvsp[0].i), BPF_JEQ, 0);
  2894. }
  2895. #line 3302 "grammar.c" /* yacc.c:1646 */
  2896. break;
  2897. case 199:
  2898. #line 742 "grammar.y" /* yacc.c:1646 */
  2899. { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  2900. #line 3308 "grammar.c" /* yacc.c:1646 */
  2901. break;
  2902. case 200:
  2903. #line 745 "grammar.y" /* yacc.c:1646 */
  2904. { (yyval.i) = M_FISU; }
  2905. #line 3314 "grammar.c" /* yacc.c:1646 */
  2906. break;
  2907. case 201:
  2908. #line 746 "grammar.y" /* yacc.c:1646 */
  2909. { (yyval.i) = M_LSSU; }
  2910. #line 3320 "grammar.c" /* yacc.c:1646 */
  2911. break;
  2912. case 202:
  2913. #line 747 "grammar.y" /* yacc.c:1646 */
  2914. { (yyval.i) = M_MSU; }
  2915. #line 3326 "grammar.c" /* yacc.c:1646 */
  2916. break;
  2917. case 203:
  2918. #line 748 "grammar.y" /* yacc.c:1646 */
  2919. { (yyval.i) = MH_FISU; }
  2920. #line 3332 "grammar.c" /* yacc.c:1646 */
  2921. break;
  2922. case 204:
  2923. #line 749 "grammar.y" /* yacc.c:1646 */
  2924. { (yyval.i) = MH_LSSU; }
  2925. #line 3338 "grammar.c" /* yacc.c:1646 */
  2926. break;
  2927. case 205:
  2928. #line 750 "grammar.y" /* yacc.c:1646 */
  2929. { (yyval.i) = MH_MSU; }
  2930. #line 3344 "grammar.c" /* yacc.c:1646 */
  2931. break;
  2932. case 206:
  2933. #line 753 "grammar.y" /* yacc.c:1646 */
  2934. { (yyval.blk).mtp3fieldtype = M_SIO; }
  2935. #line 3350 "grammar.c" /* yacc.c:1646 */
  2936. break;
  2937. case 207:
  2938. #line 754 "grammar.y" /* yacc.c:1646 */
  2939. { (yyval.blk).mtp3fieldtype = M_OPC; }
  2940. #line 3356 "grammar.c" /* yacc.c:1646 */
  2941. break;
  2942. case 208:
  2943. #line 755 "grammar.y" /* yacc.c:1646 */
  2944. { (yyval.blk).mtp3fieldtype = M_DPC; }
  2945. #line 3362 "grammar.c" /* yacc.c:1646 */
  2946. break;
  2947. case 209:
  2948. #line 756 "grammar.y" /* yacc.c:1646 */
  2949. { (yyval.blk).mtp3fieldtype = M_SLS; }
  2950. #line 3368 "grammar.c" /* yacc.c:1646 */
  2951. break;
  2952. case 210:
  2953. #line 757 "grammar.y" /* yacc.c:1646 */
  2954. { (yyval.blk).mtp3fieldtype = MH_SIO; }
  2955. #line 3374 "grammar.c" /* yacc.c:1646 */
  2956. break;
  2957. case 211:
  2958. #line 758 "grammar.y" /* yacc.c:1646 */
  2959. { (yyval.blk).mtp3fieldtype = MH_OPC; }
  2960. #line 3380 "grammar.c" /* yacc.c:1646 */
  2961. break;
  2962. case 212:
  2963. #line 759 "grammar.y" /* yacc.c:1646 */
  2964. { (yyval.blk).mtp3fieldtype = MH_DPC; }
  2965. #line 3386 "grammar.c" /* yacc.c:1646 */
  2966. break;
  2967. case 213:
  2968. #line 760 "grammar.y" /* yacc.c:1646 */
  2969. { (yyval.blk).mtp3fieldtype = MH_SLS; }
  2970. #line 3392 "grammar.c" /* yacc.c:1646 */
  2971. break;
  2972. case 215:
  2973. #line 763 "grammar.y" /* yacc.c:1646 */
  2974. { (yyval.blk).b = gen_mtp3field_code(cstate, (yyvsp[-2].blk).mtp3fieldtype, (u_int)(yyvsp[0].i), (u_int)(yyvsp[-1].i), 0); }
  2975. #line 3398 "grammar.c" /* yacc.c:1646 */
  2976. break;
  2977. case 216:
  2978. #line 764 "grammar.y" /* yacc.c:1646 */
  2979. { (yyval.blk).b = gen_mtp3field_code(cstate, (yyvsp[-2].blk).mtp3fieldtype, (u_int)(yyvsp[0].i), (u_int)(yyvsp[-1].i), 1); }
  2980. #line 3404 "grammar.c" /* yacc.c:1646 */
  2981. break;
  2982. case 217:
  2983. #line 765 "grammar.y" /* yacc.c:1646 */
  2984. { (yyval.blk).b = (yyvsp[-1].blk).b; (yyval.blk).q = qerr; }
  2985. #line 3410 "grammar.c" /* yacc.c:1646 */
  2986. break;
  2987. case 218:
  2988. #line 767 "grammar.y" /* yacc.c:1646 */
  2989. {
  2990. (yyval.blk).mtp3fieldtype = (yyvsp[-1].blk).mtp3fieldtype;
  2991. if ((yyval.blk).mtp3fieldtype == M_SIO ||
  2992. (yyval.blk).mtp3fieldtype == M_OPC ||
  2993. (yyval.blk).mtp3fieldtype == M_DPC ||
  2994. (yyval.blk).mtp3fieldtype == M_SLS ||
  2995. (yyval.blk).mtp3fieldtype == MH_SIO ||
  2996. (yyval.blk).mtp3fieldtype == MH_OPC ||
  2997. (yyval.blk).mtp3fieldtype == MH_DPC ||
  2998. (yyval.blk).mtp3fieldtype == MH_SLS)
  2999. (yyval.blk).b = gen_mtp3field_code(cstate, (yyval.blk).mtp3fieldtype, (u_int) (yyvsp[0].i), BPF_JEQ, 0);
  3000. }
  3001. #line 3427 "grammar.c" /* yacc.c:1646 */
  3002. break;
  3003. case 220:
  3004. #line 781 "grammar.y" /* yacc.c:1646 */
  3005. { gen_or((yyvsp[-2].blk).b, (yyvsp[0].blk).b); (yyval.blk) = (yyvsp[0].blk); }
  3006. #line 3433 "grammar.c" /* yacc.c:1646 */
  3007. break;
  3008. #line 3437 "grammar.c" /* yacc.c:1646 */
  3009. default: break;
  3010. }
  3011. /* User semantic actions sometimes alter yychar, and that requires
  3012. that yytoken be updated with the new translation. We take the
  3013. approach of translating immediately before every use of yytoken.
  3014. One alternative is translating here after every semantic action,
  3015. but that translation would be missed if the semantic action invokes
  3016. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  3017. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  3018. incorrect destructor might then be invoked immediately. In the
  3019. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  3020. to an incorrect destructor call or verbose syntax error message
  3021. before the lookahead is translated. */
  3022. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  3023. YYPOPSTACK (yylen);
  3024. yylen = 0;
  3025. YY_STACK_PRINT (yyss, yyssp);
  3026. *++yyvsp = yyval;
  3027. /* Now 'shift' the result of the reduction. Determine what state
  3028. that goes to, based on the state we popped back to and the rule
  3029. number reduced by. */
  3030. yyn = yyr1[yyn];
  3031. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  3032. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  3033. yystate = yytable[yystate];
  3034. else
  3035. yystate = yydefgoto[yyn - YYNTOKENS];
  3036. goto yynewstate;
  3037. /*--------------------------------------.
  3038. | yyerrlab -- here on detecting error. |
  3039. `--------------------------------------*/
  3040. yyerrlab:
  3041. /* Make sure we have latest lookahead translation. See comments at
  3042. user semantic actions for why this is necessary. */
  3043. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  3044. /* If not already recovering from an error, report this error. */
  3045. if (!yyerrstatus)
  3046. {
  3047. ++yynerrs;
  3048. #if ! YYERROR_VERBOSE
  3049. yyerror (yyscanner, cstate, YY_("syntax error"));
  3050. #else
  3051. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  3052. yyssp, yytoken)
  3053. {
  3054. char const *yymsgp = YY_("syntax error");
  3055. int yysyntax_error_status;
  3056. yysyntax_error_status = YYSYNTAX_ERROR;
  3057. if (yysyntax_error_status == 0)
  3058. yymsgp = yymsg;
  3059. else if (yysyntax_error_status == 1)
  3060. {
  3061. if (yymsg != yymsgbuf)
  3062. YYSTACK_FREE (yymsg);
  3063. yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
  3064. if (!yymsg)
  3065. {
  3066. yymsg = yymsgbuf;
  3067. yymsg_alloc = sizeof yymsgbuf;
  3068. yysyntax_error_status = 2;
  3069. }
  3070. else
  3071. {
  3072. yysyntax_error_status = YYSYNTAX_ERROR;
  3073. yymsgp = yymsg;
  3074. }
  3075. }
  3076. yyerror (yyscanner, cstate, yymsgp);
  3077. if (yysyntax_error_status == 2)
  3078. goto yyexhaustedlab;
  3079. }
  3080. # undef YYSYNTAX_ERROR
  3081. #endif
  3082. }
  3083. if (yyerrstatus == 3)
  3084. {
  3085. /* If just tried and failed to reuse lookahead token after an
  3086. error, discard it. */
  3087. if (yychar <= YYEOF)
  3088. {
  3089. /* Return failure if at end of input. */
  3090. if (yychar == YYEOF)
  3091. YYABORT;
  3092. }
  3093. else
  3094. {
  3095. yydestruct ("Error: discarding",
  3096. yytoken, &yylval, yyscanner, cstate);
  3097. yychar = YYEMPTY;
  3098. }
  3099. }
  3100. /* Else will try to reuse lookahead token after shifting the error
  3101. token. */
  3102. goto yyerrlab1;
  3103. /*---------------------------------------------------.
  3104. | yyerrorlab -- error raised explicitly by YYERROR. |
  3105. `---------------------------------------------------*/
  3106. yyerrorlab:
  3107. /* Pacify compilers like GCC when the user code never invokes
  3108. YYERROR and the label yyerrorlab therefore never appears in user
  3109. code. */
  3110. if (/*CONSTCOND*/ 0)
  3111. goto yyerrorlab;
  3112. /* Do not reclaim the symbols of the rule whose action triggered
  3113. this YYERROR. */
  3114. YYPOPSTACK (yylen);
  3115. yylen = 0;
  3116. YY_STACK_PRINT (yyss, yyssp);
  3117. yystate = *yyssp;
  3118. goto yyerrlab1;
  3119. /*-------------------------------------------------------------.
  3120. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  3121. `-------------------------------------------------------------*/
  3122. yyerrlab1:
  3123. yyerrstatus = 3; /* Each real token shifted decrements this. */
  3124. for (;;)
  3125. {
  3126. yyn = yypact[yystate];
  3127. if (!yypact_value_is_default (yyn))
  3128. {
  3129. yyn += YYTERROR;
  3130. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  3131. {
  3132. yyn = yytable[yyn];
  3133. if (0 < yyn)
  3134. break;
  3135. }
  3136. }
  3137. /* Pop the current state because it cannot handle the error token. */
  3138. if (yyssp == yyss)
  3139. YYABORT;
  3140. yydestruct ("Error: popping",
  3141. yystos[yystate], yyvsp, yyscanner, cstate);
  3142. YYPOPSTACK (1);
  3143. yystate = *yyssp;
  3144. YY_STACK_PRINT (yyss, yyssp);
  3145. }
  3146. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  3147. *++yyvsp = yylval;
  3148. YY_IGNORE_MAYBE_UNINITIALIZED_END
  3149. /* Shift the error token. */
  3150. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  3151. yystate = yyn;
  3152. goto yynewstate;
  3153. /*-------------------------------------.
  3154. | yyacceptlab -- YYACCEPT comes here. |
  3155. `-------------------------------------*/
  3156. yyacceptlab:
  3157. yyresult = 0;
  3158. goto yyreturn;
  3159. /*-----------------------------------.
  3160. | yyabortlab -- YYABORT comes here. |
  3161. `-----------------------------------*/
  3162. yyabortlab:
  3163. yyresult = 1;
  3164. goto yyreturn;
  3165. #if !defined yyoverflow || YYERROR_VERBOSE
  3166. /*-------------------------------------------------.
  3167. | yyexhaustedlab -- memory exhaustion comes here. |
  3168. `-------------------------------------------------*/
  3169. yyexhaustedlab:
  3170. yyerror (yyscanner, cstate, YY_("memory exhausted"));
  3171. yyresult = 2;
  3172. /* Fall through. */
  3173. #endif
  3174. yyreturn:
  3175. if (yychar != YYEMPTY)
  3176. {
  3177. /* Make sure we have latest lookahead translation. See comments at
  3178. user semantic actions for why this is necessary. */
  3179. yytoken = YYTRANSLATE (yychar);
  3180. yydestruct ("Cleanup: discarding lookahead",
  3181. yytoken, &yylval, yyscanner, cstate);
  3182. }
  3183. /* Do not reclaim the symbols of the rule whose action triggered
  3184. this YYABORT or YYACCEPT. */
  3185. YYPOPSTACK (yylen);
  3186. YY_STACK_PRINT (yyss, yyssp);
  3187. while (yyssp != yyss)
  3188. {
  3189. yydestruct ("Cleanup: popping",
  3190. yystos[*yyssp], yyvsp, yyscanner, cstate);
  3191. YYPOPSTACK (1);
  3192. }
  3193. #ifndef yyoverflow
  3194. if (yyss != yyssa)
  3195. YYSTACK_FREE (yyss);
  3196. #endif
  3197. #if YYERROR_VERBOSE
  3198. if (yymsg != yymsgbuf)
  3199. YYSTACK_FREE (yymsg);
  3200. #endif
  3201. return yyresult;
  3202. }
  3203. #line 783 "grammar.y" /* yacc.c:1906 */