stupidfilter.cpp 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997
  1. // Copyright 2008 Rarefied Technologies, Inc.
  2. // Distributed under the GPL v2 please see
  3. // LICENSE file for more information.
  4. #line 2 "fclassify.cpp"
  5. #line 4 "fclassify.cpp"
  6. #define YY_INT_ALIGNED short int
  7. /* A lexical scanner generated by flex */
  8. #define FLEX_SCANNER
  9. #define YY_FLEX_MAJOR_VERSION 2
  10. #define YY_FLEX_MINOR_VERSION 5
  11. #define YY_FLEX_SUBMINOR_VERSION 34
  12. #if YY_FLEX_SUBMINOR_VERSION > 0
  13. #define FLEX_BETA
  14. #endif
  15. /* First, we deal with platform-specific or compiler-specific issues. */
  16. /* begin standard C headers. */
  17. #include <stdio.h>
  18. #include <string.h>
  19. #include <errno.h>
  20. #include <stdlib.h>
  21. /* end standard C headers. */
  22. /* flex integer type definitions */
  23. #ifndef FLEXINT_H
  24. #define FLEXINT_H
  25. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  26. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  27. /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  28. * if you want the limit (max/min) macros for int types.
  29. */
  30. #ifndef __STDC_LIMIT_MACROS
  31. #define __STDC_LIMIT_MACROS 1
  32. #endif
  33. #include <inttypes.h>
  34. typedef int8_t flex_int8_t;
  35. typedef uint8_t flex_uint8_t;
  36. typedef int16_t flex_int16_t;
  37. typedef uint16_t flex_uint16_t;
  38. typedef int32_t flex_int32_t;
  39. typedef uint32_t flex_uint32_t;
  40. #else
  41. typedef signed char flex_int8_t;
  42. typedef short int flex_int16_t;
  43. typedef int flex_int32_t;
  44. typedef unsigned char flex_uint8_t;
  45. typedef unsigned short int flex_uint16_t;
  46. typedef unsigned int flex_uint32_t;
  47. #endif /* ! C99 */
  48. /* Limits of integral types. */
  49. #ifndef INT8_MIN
  50. #define INT8_MIN (-128)
  51. #endif
  52. #ifndef INT16_MIN
  53. #define INT16_MIN (-32767-1)
  54. #endif
  55. #ifndef INT32_MIN
  56. #define INT32_MIN (-2147483647-1)
  57. #endif
  58. #ifndef INT8_MAX
  59. #define INT8_MAX (127)
  60. #endif
  61. #ifndef INT16_MAX
  62. #define INT16_MAX (32767)
  63. #endif
  64. #ifndef INT32_MAX
  65. #define INT32_MAX (2147483647)
  66. #endif
  67. #ifndef UINT8_MAX
  68. #define UINT8_MAX (255U)
  69. #endif
  70. #ifndef UINT16_MAX
  71. #define UINT16_MAX (65535U)
  72. #endif
  73. #ifndef UINT32_MAX
  74. #define UINT32_MAX (4294967295U)
  75. #endif
  76. #endif /* ! FLEXINT_H */
  77. #ifdef __cplusplus
  78. /* The "const" storage-class-modifier is valid. */
  79. #define YY_USE_CONST
  80. #else /* ! __cplusplus */
  81. /* C99 requires __STDC__ to be defined as 1. */
  82. #if defined (__STDC__)
  83. #define YY_USE_CONST
  84. #endif /* defined (__STDC__) */
  85. #endif /* ! __cplusplus */
  86. #ifdef YY_USE_CONST
  87. #define yyconst const
  88. #else
  89. #define yyconst
  90. #endif
  91. /* Returned upon end-of-file. */
  92. #define YY_NULL 0
  93. /* Promotes a possibly negative, possibly signed char to an unsigned
  94. * integer for use as an array index. If the signed char is negative,
  95. * we want to instead treat it as an 8-bit unsigned char, hence the
  96. * double cast.
  97. */
  98. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  99. /* Enter a start condition. This macro really ought to take a parameter,
  100. * but we do it the disgusting crufty way forced on us by the ()-less
  101. * definition of BEGIN.
  102. */
  103. #define BEGIN (yy_start) = 1 + 2 *
  104. /* Translate the current start state into a value that can be later handed
  105. * to BEGIN to return to the state. The YYSTATE alias is for lex
  106. * compatibility.
  107. */
  108. #define YY_START (((yy_start) - 1) / 2)
  109. #define YYSTATE YY_START
  110. /* Action number for EOF rule of a given start state. */
  111. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  112. /* Special action meaning "start processing a new file". */
  113. #define YY_NEW_FILE yyrestart(yyin )
  114. #define YY_END_OF_BUFFER_CHAR 0
  115. /* Size of default input buffer. */
  116. #ifndef YY_BUF_SIZE
  117. #define YY_BUF_SIZE 16384
  118. #endif
  119. /* The state buf must be large enough to hold one state per character in the main buffer.
  120. */
  121. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  122. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  123. #define YY_TYPEDEF_YY_BUFFER_STATE
  124. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  125. #endif
  126. extern int yyleng;
  127. extern FILE *yyin, *yyout;
  128. #define EOB_ACT_CONTINUE_SCAN 0
  129. #define EOB_ACT_END_OF_FILE 1
  130. #define EOB_ACT_LAST_MATCH 2
  131. #define YY_LESS_LINENO(n)
  132. /* Return all but the first "n" matched characters back to the input stream. */
  133. #define yyless(n) \
  134. do \
  135. { \
  136. /* Undo effects of setting up yytext. */ \
  137. int yyless_macro_arg = (n); \
  138. YY_LESS_LINENO(yyless_macro_arg);\
  139. *yy_cp = (yy_hold_char); \
  140. YY_RESTORE_YY_MORE_OFFSET \
  141. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  142. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  143. } \
  144. while ( 0 )
  145. #define unput(c) yyunput( c, (yytext_ptr) )
  146. /* The following is because we cannot portably get our hands on size_t
  147. * (without autoconf's help, which isn't available because we want
  148. * flex-generated scanners to compile on their own).
  149. * Given that the standard has decreed that size_t exists since 1989,
  150. * I guess we can afford to depend on it. Manoj.
  151. */
  152. #ifndef YY_TYPEDEF_YY_SIZE_T
  153. #define YY_TYPEDEF_YY_SIZE_T
  154. typedef size_t yy_size_t;
  155. #endif
  156. #ifndef YY_STRUCT_YY_BUFFER_STATE
  157. #define YY_STRUCT_YY_BUFFER_STATE
  158. struct yy_buffer_state
  159. {
  160. FILE *yy_input_file;
  161. char *yy_ch_buf; /* input buffer */
  162. char *yy_buf_pos; /* current position in input buffer */
  163. /* Size of input buffer in bytes, not including room for EOB
  164. * characters.
  165. */
  166. yy_size_t yy_buf_size;
  167. /* Number of characters read into yy_ch_buf, not including EOB
  168. * characters.
  169. */
  170. int yy_n_chars;
  171. /* Whether we "own" the buffer - i.e., we know we created it,
  172. * and can realloc() it to grow it, and should free() it to
  173. * delete it.
  174. */
  175. int yy_is_our_buffer;
  176. /* Whether this is an "interactive" input source; if so, and
  177. * if we're using stdio for input, then we want to use getc()
  178. * instead of fread(), to make sure we stop fetching input after
  179. * each newline.
  180. */
  181. int yy_is_interactive;
  182. /* Whether we're considered to be at the beginning of a line.
  183. * If so, '^' rules will be active on the next match, otherwise
  184. * not.
  185. */
  186. int yy_at_bol;
  187. int yy_bs_lineno; /**< The line count. */
  188. int yy_bs_column; /**< The column count. */
  189. /* Whether to try to fill the input buffer when we reach the
  190. * end of it.
  191. */
  192. int yy_fill_buffer;
  193. int yy_buffer_status;
  194. #define YY_BUFFER_NEW 0
  195. #define YY_BUFFER_NORMAL 1
  196. /* When an EOF's been seen but there's still some text to process
  197. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  198. * shouldn't try reading from the input source any more. We might
  199. * still have a bunch of tokens to match, though, because of
  200. * possible backing-up.
  201. *
  202. * When we actually see the EOF, we change the status to "new"
  203. * (via yyrestart()), so that the user can continue scanning by
  204. * just pointing yyin at a new input file.
  205. */
  206. #define YY_BUFFER_EOF_PENDING 2
  207. };
  208. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  209. /* Stack of input buffers. */
  210. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  211. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  212. static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
  213. /* We provide macros for accessing buffer states in case in the
  214. * future we want to put the buffer states in a more general
  215. * "scanner state".
  216. *
  217. * Returns the top of the stack, or NULL.
  218. */
  219. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  220. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  221. : NULL)
  222. /* Same as previous macro, but useful when we know that the buffer stack is not
  223. * NULL or when we need an lvalue. For internal use only.
  224. */
  225. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  226. /* yy_hold_char holds the character lost when yytext is formed. */
  227. static char yy_hold_char;
  228. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  229. int yyleng;
  230. /* Points to current character in buffer. */
  231. static char *yy_c_buf_p = (char *) 0;
  232. static int yy_init = 0; /* whether we need to initialize */
  233. static int yy_start = 0; /* start state number */
  234. /* Flag which is used to allow yywrap()'s to do buffer switches
  235. * instead of setting up a fresh yyin. A bit of a hack ...
  236. */
  237. static int yy_did_buffer_switch_on_eof;
  238. void yyrestart (FILE *input_file );
  239. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
  240. YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
  241. void yy_delete_buffer (YY_BUFFER_STATE b );
  242. void yy_flush_buffer (YY_BUFFER_STATE b );
  243. void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
  244. void yypop_buffer_state (void );
  245. static void yyensure_buffer_stack (void );
  246. static void yy_load_buffer_state (void );
  247. static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
  248. #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
  249. YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
  250. YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
  251. YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
  252. void *yyalloc (yy_size_t );
  253. void *yyrealloc (void *,yy_size_t );
  254. void yyfree (void * );
  255. #define yy_new_buffer yy_create_buffer
  256. #define yy_set_interactive(is_interactive) \
  257. { \
  258. if ( ! YY_CURRENT_BUFFER ){ \
  259. yyensure_buffer_stack (); \
  260. YY_CURRENT_BUFFER_LVALUE = \
  261. yy_create_buffer(yyin,YY_BUF_SIZE ); \
  262. } \
  263. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  264. }
  265. #define yy_set_bol(at_bol) \
  266. { \
  267. if ( ! YY_CURRENT_BUFFER ){\
  268. yyensure_buffer_stack (); \
  269. YY_CURRENT_BUFFER_LVALUE = \
  270. yy_create_buffer(yyin,YY_BUF_SIZE ); \
  271. } \
  272. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  273. }
  274. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  275. /* Begin user sect3 */
  276. typedef unsigned char YY_CHAR;
  277. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  278. typedef int yy_state_type;
  279. extern int yylineno;
  280. int yylineno = 1;
  281. extern char *yytext;
  282. #define yytext_ptr yytext
  283. static yy_state_type yy_get_previous_state (void );
  284. static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
  285. static int yy_get_next_buffer (void );
  286. static void yy_fatal_error (yyconst char msg[] );
  287. /* Done after the current pattern has been matched and before the
  288. * corresponding action - sets up yytext.
  289. */
  290. #define YY_DO_BEFORE_ACTION \
  291. (yytext_ptr) = yy_bp; \
  292. yyleng = (size_t) (yy_cp - yy_bp); \
  293. (yy_hold_char) = *yy_cp; \
  294. *yy_cp = '\0'; \
  295. (yy_c_buf_p) = yy_cp;
  296. #define YY_NUM_RULES 12
  297. #define YY_END_OF_BUFFER 13
  298. /* This struct is not used in this scanner,
  299. but its presence is necessary. */
  300. struct yy_trans_info
  301. {
  302. flex_int32_t yy_verify;
  303. flex_int32_t yy_nxt;
  304. };
  305. static yyconst flex_int16_t yy_acclist[123] =
  306. { 0,
  307. 13, 1, 5, 11, 12, 1, 10, 11, 12, 10,
  308. 12, 1, 5, 10, 11, 12, 1, 10, 11, 12,
  309. 1, 4, 5, 11, 12, 1, 4, 5, 11, 12,
  310. 1, 4, 5, 11, 12, 1, 5, 11, 12, 1,
  311. 4, 5, 11, 12, 1, 3, 5, 11, 12, 1,
  312. 3, 5, 11, 12, 1, 2, 5, 11, 12, 1,
  313. 2, 5, 11, 12, 1, 2, 5, 11, 12, 1,
  314. 2, 5, 11, 12, 5, 9, 5, 8, 5, 5,
  315. 8, 5, 8, 5, 5, 5, 5, 5, 5, 8,
  316. 5, 8, 5, 8, 5, 5, 5, 5, 8, 5,
  317. 8, 5, 8, 5, 8, 5, 7, 6, 5, 5,
  318. 8, 5, 5, 8, 5, 8, 5, 5, 5, 5,
  319. 5, 8
  320. } ;
  321. static yyconst flex_int16_t yy_accept[201] =
  322. { 0,
  323. 1, 1, 1, 2, 6, 10, 12, 17, 21, 26,
  324. 31, 36, 40, 45, 50, 55, 60, 65, 70, 75,
  325. 76, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  326. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  327. 77, 77, 77, 79, 80, 82, 84, 85, 86, 87,
  328. 88, 89, 91, 93, 95, 96, 97, 98, 98, 98,
  329. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  330. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  331. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  332. 98, 98, 98, 98, 98, 100, 102, 104, 106, 107,
  333. 108, 109, 110, 112, 113, 115, 117, 118, 119, 120,
  334. 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
  335. 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
  336. 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
  337. 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
  338. 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
  339. 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
  340. 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
  341. 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
  342. 123, 123, 123, 123, 123, 123, 123, 123, 123, 123
  343. } ;
  344. static yyconst flex_int32_t yy_ec[256] =
  345. { 0,
  346. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  347. 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
  348. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  349. 1, 5, 6, 7, 7, 7, 7, 7, 7, 7,
  350. 7, 7, 7, 8, 7, 9, 7, 1, 10, 1,
  351. 1, 11, 1, 1, 1, 12, 1, 7, 7, 7,
  352. 7, 7, 13, 7, 14, 14, 14, 14, 15, 14,
  353. 14, 14, 14, 14, 14, 16, 14, 14, 17, 14,
  354. 14, 18, 14, 14, 19, 14, 14, 14, 14, 14,
  355. 7, 7, 7, 1, 7, 7, 20, 21, 22, 23,
  356. 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
  357. 34, 35, 29, 36, 37, 38, 39, 40, 41, 29,
  358. 42, 43, 7, 7, 7, 7, 1, 1, 1, 1,
  359. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  360. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  361. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  362. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  363. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  364. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  365. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  366. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  367. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  368. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  369. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  370. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  371. 1, 1, 1, 1, 1
  372. } ;
  373. static yyconst flex_int32_t yy_meta[44] =
  374. { 0,
  375. 1, 2, 2, 1, 2, 1, 1, 1, 1, 1,
  376. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  377. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  378. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  379. 1, 1, 1
  380. } ;
  381. static yyconst flex_int16_t yy_base[203] =
  382. { 0,
  383. 0, 0, 421, 0, 422, 422, 0, 39, 76, 0,
  384. 411, 39, 41, 110, 129, 135, 83, 149, 156, 0,
  385. 422, 382, 400, 47, 389, 14, 67, 376, 18, 153,
  386. 391, 51, 76, 93, 409, 378, 68, 73, 28, 150,
  387. 154, 174, 121, 403, 171, 189, 395, 383, 389, 377,
  388. 146, 147, 401, 400, 180, 201, 219, 366, 389, 383,
  389. 365, 364, 183, 378, 356, 360, 359, 191, 359, 168,
  390. 177, 362, 197, 389, 381, 369, 354, 385, 384, 364,
  391. 347, 381, 358, 353, 363, 350, 349, 356, 341, 156,
  392. 198, 340, 346, 356, 0, 225, 369, 368, 238, 422,
  393. 422, 252, 246, 261, 266, 271, 276, 280, 242, 284,
  394. 337, 367, 328, 346, 203, 349, 363, 340, 361, 341,
  395. 247, 359, 358, 357, 356, 355, 323, 316, 337, 104,
  396. 247, 351, 350, 349, 323, 347, 346, 345, 318, 324,
  397. 337, 310, 321, 339, 338, 337, 336, 309, 334, 288,
  398. 314, 309, 313, 303, 302, 300, 327, 307, 325, 287,
  399. 318, 296, 293, 320, 296, 318, 280, 311, 315, 264,
  400. 314, 313, 309, 280, 307, 287, 305, 262, 304, 298,
  401. 301, 274, 299, 298, 297, 295, 261, 292, 270, 290,
  402. 289, 245, 228, 184, 203, 165, 185, 103, 422, 68,
  403. 67, 315
  404. } ;
  405. static yyconst flex_int16_t yy_def[203] =
  406. { 0,
  407. 199, 1, 199, 200, 199, 199, 200, 199, 200, 200,
  408. 200, 9, 9, 201, 201, 200, 200, 200, 200, 200,
  409. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  410. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  411. 199, 199, 200, 200, 9, 9, 200, 200, 200, 200,
  412. 9, 9, 200, 200, 202, 15, 202, 199, 199, 199,
  413. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  414. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  415. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  416. 199, 199, 199, 199, 200, 200, 200, 200, 202, 199,
  417. 199, 200, 202, 202, 202, 202, 202, 202, 202, 202,
  418. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  419. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  420. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  421. 199, 199, 199, 199, 199, 199, 199, 199, 199, 202,
  422. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  423. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  424. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  425. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  426. 199, 199, 199, 199, 199, 199, 199, 199, 0, 199,
  427. 199, 199
  428. } ;
  429. static yyconst flex_int16_t yy_nxt[466] =
  430. { 0,
  431. 4, 5, 6, 7, 8, 9, 10, 10, 11, 12,
  432. 4, 4, 13, 14, 14, 14, 15, 14, 14, 16,
  433. 17, 17, 17, 17, 17, 17, 18, 17, 17, 17,
  434. 17, 17, 17, 19, 17, 17, 17, 17, 17, 17,
  435. 17, 17, 17, 21, 52, 72, 52, 65, 53, 22,
  436. 53, 54, 66, 54, 88, 89, 73, 23, 24, 25,
  437. 26, 27, 28, 29, 30, 31, 32, 56, 20, 33,
  438. 34, 35, 21, 36, 37, 38, 39, 40, 60, 41,
  439. 42, 43, 78, 61, 44, 45, 67, 62, 46, 63,
  440. 68, 85, 47, 79, 69, 48, 55, 55, 55, 55,
  441. 55, 55, 49, 80, 82, 70, 86, 21, 21, 50,
  442. 20, 87, 83, 20, 81, 20, 20, 20, 20, 20,
  443. 20, 20, 20, 55, 55, 55, 55, 55, 55, 20,
  444. 95, 163, 20, 95, 20, 20, 20, 20, 20, 20,
  445. 20, 20, 55, 55, 57, 55, 55, 55, 55, 55,
  446. 55, 55, 55, 55, 21, 53, 97, 21, 54, 98,
  447. 21, 51, 55, 55, 55, 55, 55, 55, 51, 55,
  448. 55, 55, 55, 55, 55, 74, 96, 91, 21, 144,
  449. 53, 100, 100, 54, 100, 90, 51, 21, 75, 21,
  450. 198, 76, 92, 93, 96, 21, 126, 94, 53, 124,
  451. 127, 54, 101, 101, 125, 101, 102, 21, 102, 102,
  452. 116, 197, 128, 102, 20, 20, 20, 20, 20, 20,
  453. 100, 100, 122, 100, 103, 117, 130, 104, 105, 131,
  454. 145, 106, 21, 146, 95, 107, 154, 95, 108, 100,
  455. 100, 155, 100, 100, 100, 109, 100, 100, 100, 21,
  456. 100, 21, 110, 101, 101, 150, 101, 102, 150, 102,
  457. 102, 150, 100, 100, 102, 100, 21, 100, 100, 150,
  458. 100, 150, 100, 100, 164, 100, 150, 100, 100, 165,
  459. 100, 100, 100, 159, 100, 100, 100, 187, 100, 100,
  460. 100, 150, 100, 21, 21, 196, 21, 195, 192, 21,
  461. 188, 21, 21, 21, 194, 21, 150, 193, 21, 191,
  462. 190, 21, 189, 21, 150, 99, 99, 21, 21, 21,
  463. 186, 185, 21, 184, 21, 183, 182, 181, 180, 21,
  464. 179, 21, 178, 177, 176, 175, 174, 173, 21, 172,
  465. 21, 21, 21, 21, 171, 170, 169, 168, 167, 21,
  466. 21, 21, 166, 21, 21, 21, 162, 161, 160, 21,
  467. 21, 21, 21, 21, 158, 21, 157, 21, 156, 153,
  468. 152, 21, 151, 95, 95, 149, 148, 147, 143, 142,
  469. 141, 140, 139, 138, 137, 21, 136, 135, 21, 21,
  470. 134, 133, 132, 21, 129, 123, 121, 120, 119, 118,
  471. 115, 114, 113, 112, 111, 95, 95, 95, 95, 95,
  472. 95, 95, 84, 21, 77, 71, 64, 59, 58, 51,
  473. 199, 3, 199, 199, 199, 199, 199, 199, 199, 199,
  474. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  475. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  476. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  477. 199, 199, 199, 199, 199
  478. } ;
  479. static yyconst flex_int16_t yy_chk[466] =
  480. { 0,
  481. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  482. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  483. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  484. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  485. 1, 1, 1, 8, 12, 29, 13, 26, 12, 8,
  486. 13, 12, 26, 13, 39, 39, 29, 8, 8, 8,
  487. 8, 8, 8, 8, 8, 8, 8, 201, 200, 8,
  488. 8, 8, 37, 8, 8, 8, 8, 8, 24, 8,
  489. 8, 9, 32, 24, 9, 9, 27, 24, 9, 24,
  490. 27, 37, 9, 32, 27, 9, 17, 17, 17, 17,
  491. 17, 17, 9, 33, 34, 27, 38, 198, 130, 9,
  492. 14, 38, 34, 14, 33, 14, 14, 14, 14, 14,
  493. 14, 14, 14, 14, 14, 14, 14, 14, 14, 15,
  494. 43, 130, 15, 43, 15, 15, 15, 15, 15, 15,
  495. 15, 15, 15, 15, 15, 15, 15, 15, 16, 16,
  496. 16, 16, 16, 16, 40, 51, 52, 30, 51, 52,
  497. 90, 16, 18, 18, 18, 18, 18, 18, 18, 19,
  498. 19, 19, 19, 19, 19, 30, 45, 41, 42, 90,
  499. 45, 55, 55, 45, 55, 40, 19, 63, 30, 197,
  500. 196, 30, 41, 42, 46, 68, 71, 42, 46, 70,
  501. 71, 46, 56, 56, 70, 56, 56, 195, 56, 56,
  502. 63, 194, 71, 56, 56, 56, 56, 56, 56, 56,
  503. 57, 57, 68, 57, 57, 63, 73, 57, 57, 73,
  504. 91, 57, 193, 91, 96, 57, 115, 96, 57, 99,
  505. 99, 115, 99, 109, 109, 57, 109, 103, 103, 192,
  506. 103, 121, 57, 102, 102, 103, 102, 102, 103, 102,
  507. 102, 109, 104, 104, 102, 104, 178, 105, 105, 104,
  508. 105, 105, 106, 106, 131, 106, 106, 107, 107, 131,
  509. 107, 108, 108, 121, 108, 110, 110, 170, 110, 150,
  510. 150, 107, 150, 191, 190, 189, 188, 187, 178, 186,
  511. 170, 185, 184, 183, 182, 181, 108, 180, 179, 177,
  512. 176, 175, 174, 173, 110, 202, 202, 172, 171, 169,
  513. 168, 167, 166, 165, 164, 163, 162, 161, 160, 159,
  514. 158, 157, 156, 155, 154, 153, 152, 151, 149, 148,
  515. 147, 146, 145, 144, 143, 142, 141, 140, 139, 138,
  516. 137, 136, 135, 134, 133, 132, 129, 128, 127, 126,
  517. 125, 124, 123, 122, 120, 119, 118, 117, 116, 114,
  518. 113, 112, 111, 98, 97, 94, 93, 92, 89, 88,
  519. 87, 86, 85, 84, 83, 82, 81, 80, 79, 78,
  520. 77, 76, 75, 74, 72, 69, 67, 66, 65, 64,
  521. 62, 61, 60, 59, 58, 54, 53, 50, 49, 48,
  522. 47, 44, 36, 35, 31, 28, 25, 23, 22, 11,
  523. 3, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  524. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  525. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  526. 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
  527. 199, 199, 199, 199, 199
  528. } ;
  529. extern int yy_flex_debug;
  530. int yy_flex_debug = 0;
  531. static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
  532. static char *yy_full_match;
  533. static int yy_lp;
  534. #define REJECT \
  535. { \
  536. *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
  537. yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
  538. ++(yy_lp); \
  539. goto find_rule; \
  540. }
  541. #define yymore() yymore_used_but_not_detected
  542. #define YY_MORE_ADJ 0
  543. #define YY_RESTORE_YY_MORE_OFFSET
  544. char *yytext;
  545. #line 1 "fclassify.flex"
  546. float misspell = 0, word_length = 0, num_total = 0, num_lowers = 0, num_caps = 0, num_punct = 0, word_count = 0, initial_cap = 0, intercap = 0, repeat_emphasis = 0;
  547. #line 649 "fclassify.cpp"
  548. #define INITIAL 0
  549. #ifndef YY_NO_UNISTD_H
  550. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  551. * down here because we want the user's section 1 to have been scanned first.
  552. * The user has a chance to override it with an option.
  553. */
  554. #include <unistd.h>
  555. #endif
  556. #ifndef YY_EXTRA_TYPE
  557. #define YY_EXTRA_TYPE void *
  558. #endif
  559. static int yy_init_globals (void );
  560. /* Macros after this point can all be overridden by user definitions in
  561. * section 1.
  562. */
  563. #ifndef YY_SKIP_YYWRAP
  564. #ifdef __cplusplus
  565. extern "C" int yywrap (void );
  566. #else
  567. extern int yywrap (void );
  568. #endif
  569. #endif
  570. static void yyunput (int c,char *buf_ptr );
  571. #ifndef yytext_ptr
  572. static void yy_flex_strncpy (char *,yyconst char *,int );
  573. #endif
  574. #ifdef YY_NEED_STRLEN
  575. static int yy_flex_strlen (yyconst char * );
  576. #endif
  577. #ifndef YY_NO_INPUT
  578. #ifdef __cplusplus
  579. static int yyinput (void );
  580. #else
  581. static int input (void );
  582. #endif
  583. #endif
  584. /* Amount of stuff to slurp up with each read. */
  585. #ifndef YY_READ_BUF_SIZE
  586. #define YY_READ_BUF_SIZE 8192
  587. #endif
  588. /* Copy whatever the last rule matched to the standard output. */
  589. #ifndef ECHO
  590. /* This used to be an fputs(), but since the string might contain NUL's,
  591. * we now use fwrite().
  592. */
  593. #define ECHO fwrite( yytext, yyleng, 1, yyout )
  594. #endif
  595. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  596. * is returned in "result".
  597. */
  598. #ifndef YY_INPUT
  599. #define YY_INPUT(buf,result,max_size) \
  600. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  601. { \
  602. int c = '*'; \
  603. int n; \
  604. for ( n = 0; n < max_size && \
  605. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  606. buf[n] = (char) c; \
  607. if ( c == '\n' ) \
  608. buf[n++] = (char) c; \
  609. if ( c == EOF && ferror( yyin ) ) \
  610. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  611. result = n; \
  612. } \
  613. else \
  614. { \
  615. errno=0; \
  616. while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  617. { \
  618. if( errno != EINTR) \
  619. { \
  620. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  621. break; \
  622. } \
  623. errno=0; \
  624. clearerr(yyin); \
  625. } \
  626. }\
  627. \
  628. #endif
  629. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  630. * we don't want an extra ';' after the "return" because that will cause
  631. * some compilers to complain about unreachable statements.
  632. */
  633. #ifndef yyterminate
  634. #define yyterminate() return YY_NULL
  635. #endif
  636. /* Number of entries by which start-condition stack grows. */
  637. #ifndef YY_START_STACK_INCR
  638. #define YY_START_STACK_INCR 25
  639. #endif
  640. /* Report a fatal error. */
  641. #ifndef YY_FATAL_ERROR
  642. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  643. #endif
  644. /* end tables serialization structures and prototypes */
  645. /* Default declaration of generated scanner - a define so the user can
  646. * easily add parameters.
  647. */
  648. #ifndef YY_DECL
  649. #define YY_DECL_IS_OURS 1
  650. extern int yylex (void);
  651. #define YY_DECL int yylex (void)
  652. #endif /* !YY_DECL */
  653. /* Code executed at the beginning of each rule, after yytext and yyleng
  654. * have been set up.
  655. */
  656. #ifndef YY_USER_ACTION
  657. #define YY_USER_ACTION
  658. #endif
  659. /* Code executed at the end of each rule. */
  660. #ifndef YY_BREAK
  661. #define YY_BREAK break;
  662. #endif
  663. #define YY_RULE_SETUP \
  664. YY_USER_ACTION
  665. /** The main scanner function which does all the work.
  666. */
  667. YY_DECL
  668. {
  669. register yy_state_type yy_current_state;
  670. register char *yy_cp, *yy_bp;
  671. register int yy_act;
  672. #line 4 "fclassify.flex"
  673. #line 804 "fclassify.cpp"
  674. if ( !(yy_init) )
  675. {
  676. (yy_init) = 1;
  677. #ifdef YY_USER_INIT
  678. YY_USER_INIT;
  679. #endif
  680. /* Create the reject buffer large enough to save one state per allowed character. */
  681. if ( ! (yy_state_buf) )
  682. (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE );
  683. if ( ! (yy_state_buf) )
  684. YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
  685. if ( ! (yy_start) )
  686. (yy_start) = 1; /* first start state */
  687. if ( ! yyin )
  688. yyin = stdin;
  689. if ( ! yyout )
  690. yyout = stdout;
  691. if ( ! YY_CURRENT_BUFFER ) {
  692. yyensure_buffer_stack ();
  693. YY_CURRENT_BUFFER_LVALUE =
  694. yy_create_buffer(yyin,YY_BUF_SIZE );
  695. }
  696. yy_load_buffer_state( );
  697. }
  698. while ( 1 ) /* loops until end-of-file is reached */
  699. {
  700. yy_cp = (yy_c_buf_p);
  701. /* Support of yytext. */
  702. *yy_cp = (yy_hold_char);
  703. /* yy_bp points to the position in yy_ch_buf of the start of
  704. * the current run.
  705. */
  706. yy_bp = yy_cp;
  707. yy_current_state = (yy_start);
  708. (yy_state_ptr) = (yy_state_buf);
  709. *(yy_state_ptr)++ = yy_current_state;
  710. yy_match:
  711. do
  712. {
  713. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  714. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  715. {
  716. yy_current_state = (int) yy_def[yy_current_state];
  717. if ( yy_current_state >= 200 )
  718. yy_c = yy_meta[(unsigned int) yy_c];
  719. }
  720. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  721. *(yy_state_ptr)++ = yy_current_state;
  722. ++yy_cp;
  723. }
  724. while ( yy_base[yy_current_state] != 422 );
  725. yy_find_action:
  726. yy_current_state = *--(yy_state_ptr);
  727. (yy_lp) = yy_accept[yy_current_state];
  728. find_rule: /* we branch to this label when backing up */
  729. for ( ; ; ) /* until we find what rule we matched */
  730. {
  731. if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
  732. {
  733. yy_act = yy_acclist[(yy_lp)];
  734. {
  735. (yy_full_match) = yy_cp;
  736. break;
  737. }
  738. }
  739. --yy_cp;
  740. yy_current_state = *--(yy_state_ptr);
  741. (yy_lp) = yy_accept[yy_current_state];
  742. }
  743. YY_DO_BEFORE_ACTION;
  744. do_action: /* This label is used only to access EOF actions. */
  745. switch ( yy_act )
  746. { /* beginning of action switch */
  747. case 1:
  748. YY_RULE_SETUP
  749. #line 5 "fclassify.flex"
  750. ++num_total; REJECT;
  751. YY_BREAK
  752. case 2:
  753. YY_RULE_SETUP
  754. #line 6 "fclassify.flex"
  755. ++num_lowers; REJECT;
  756. YY_BREAK
  757. case 3:
  758. YY_RULE_SETUP
  759. #line 7 "fclassify.flex"
  760. ++num_caps; REJECT;
  761. YY_BREAK
  762. case 4:
  763. YY_RULE_SETUP
  764. #line 8 "fclassify.flex"
  765. ++num_punct; REJECT;
  766. YY_BREAK
  767. case 5:
  768. YY_RULE_SETUP
  769. #line 9 "fclassify.flex"
  770. ++word_count; REJECT;
  771. YY_BREAK
  772. case 6:
  773. /* rule 6 can match eol */
  774. YY_RULE_SETUP
  775. #line 10 "fclassify.flex"
  776. ++initial_cap; REJECT;
  777. YY_BREAK
  778. case 7:
  779. /* rule 7 can match eol */
  780. YY_RULE_SETUP
  781. #line 11 "fclassify.flex"
  782. ++intercap; REJECT;
  783. YY_BREAK
  784. case 8:
  785. YY_RULE_SETUP
  786. #line 12 "fclassify.flex"
  787. ++repeat_emphasis; REJECT;
  788. YY_BREAK
  789. case 9:
  790. YY_RULE_SETUP
  791. #line 13 "fclassify.flex"
  792. ++misspell; REJECT;
  793. YY_BREAK
  794. case 10:
  795. /* rule 10 can match eol */
  796. YY_RULE_SETUP
  797. #line 14 "fclassify.flex"
  798. ;
  799. YY_BREAK
  800. case 11:
  801. YY_RULE_SETUP
  802. #line 15 "fclassify.flex"
  803. ;
  804. YY_BREAK
  805. case 12:
  806. YY_RULE_SETUP
  807. #line 16 "fclassify.flex"
  808. ECHO;
  809. YY_BREAK
  810. #line 959 "fclassify.cpp"
  811. case YY_STATE_EOF(INITIAL):
  812. yyterminate();
  813. case YY_END_OF_BUFFER:
  814. {
  815. /* Amount of text matched not including the EOB char. */
  816. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  817. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  818. *yy_cp = (yy_hold_char);
  819. YY_RESTORE_YY_MORE_OFFSET
  820. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  821. {
  822. /* We're scanning a new file or input source. It's
  823. * possible that this happened because the user
  824. * just pointed yyin at a new source and called
  825. * yylex(). If so, then we have to assure
  826. * consistency between YY_CURRENT_BUFFER and our
  827. * globals. Here is the right place to do so, because
  828. * this is the first action (other than possibly a
  829. * back-up) that will match for the new input source.
  830. */
  831. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  832. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  833. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  834. }
  835. /* Note that here we test for yy_c_buf_p "<=" to the position
  836. * of the first EOB in the buffer, since yy_c_buf_p will
  837. * already have been incremented past the NUL character
  838. * (since all states make transitions on EOB to the
  839. * end-of-buffer state). Contrast this with the test
  840. * in input().
  841. */
  842. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  843. { /* This was really a NUL. */
  844. yy_state_type yy_next_state;
  845. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  846. yy_current_state = yy_get_previous_state( );
  847. /* Okay, we're now positioned to make the NUL
  848. * transition. We couldn't have
  849. * yy_get_previous_state() go ahead and do it
  850. * for us because it doesn't know how to deal
  851. * with the possibility of jamming (and we don't
  852. * want to build jamming into it because then it
  853. * will run more slowly).
  854. */
  855. yy_next_state = yy_try_NUL_trans( yy_current_state );
  856. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  857. if ( yy_next_state )
  858. {
  859. /* Consume the NUL. */
  860. yy_cp = ++(yy_c_buf_p);
  861. yy_current_state = yy_next_state;
  862. goto yy_match;
  863. }
  864. else
  865. {
  866. yy_cp = (yy_c_buf_p);
  867. goto yy_find_action;
  868. }
  869. }
  870. else switch ( yy_get_next_buffer( ) )
  871. {
  872. case EOB_ACT_END_OF_FILE:
  873. {
  874. (yy_did_buffer_switch_on_eof) = 0;
  875. if ( yywrap( ) )
  876. {
  877. /* Note: because we've taken care in
  878. * yy_get_next_buffer() to have set up
  879. * yytext, we can now set up
  880. * yy_c_buf_p so that if some total
  881. * hoser (like flex itself) wants to
  882. * call the scanner after we return the
  883. * YY_NULL, it'll still work - another
  884. * YY_NULL will get returned.
  885. */
  886. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  887. yy_act = YY_STATE_EOF(YY_START);
  888. goto do_action;
  889. }
  890. else
  891. {
  892. if ( ! (yy_did_buffer_switch_on_eof) )
  893. YY_NEW_FILE;
  894. }
  895. break;
  896. }
  897. case EOB_ACT_CONTINUE_SCAN:
  898. (yy_c_buf_p) =
  899. (yytext_ptr) + yy_amount_of_matched_text;
  900. yy_current_state = yy_get_previous_state( );
  901. yy_cp = (yy_c_buf_p);
  902. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  903. goto yy_match;
  904. case EOB_ACT_LAST_MATCH:
  905. (yy_c_buf_p) =
  906. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  907. yy_current_state = yy_get_previous_state( );
  908. yy_cp = (yy_c_buf_p);
  909. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  910. goto yy_find_action;
  911. }
  912. break;
  913. }
  914. default:
  915. YY_FATAL_ERROR(
  916. "fatal flex scanner internal error--no action found" );
  917. } /* end of action switch */
  918. } /* end of scanning one token */
  919. } /* end of yylex */
  920. /* yy_get_next_buffer - try to read in a new buffer
  921. *
  922. * Returns a code representing an action:
  923. * EOB_ACT_LAST_MATCH -
  924. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  925. * EOB_ACT_END_OF_FILE - end of file
  926. */
  927. static int yy_get_next_buffer (void)
  928. {
  929. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  930. register char *source = (yytext_ptr);
  931. register int number_to_move, i;
  932. int ret_val;
  933. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  934. YY_FATAL_ERROR(
  935. "fatal flex scanner internal error--end of buffer missed" );
  936. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  937. { /* Don't try to fill the buffer, so this is an EOF. */
  938. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  939. {
  940. /* We matched a single character, the EOB, so
  941. * treat this as a final EOF.
  942. */
  943. return EOB_ACT_END_OF_FILE;
  944. }
  945. else
  946. {
  947. /* We matched some text prior to the EOB, first
  948. * process it.
  949. */
  950. return EOB_ACT_LAST_MATCH;
  951. }
  952. }
  953. /* Try to read more data. */
  954. /* First move last chars to start of buffer. */
  955. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  956. for ( i = 0; i < number_to_move; ++i )
  957. *(dest++) = *(source++);
  958. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  959. /* don't do the read, it's not guaranteed to return an EOF,
  960. * just force an EOF
  961. */
  962. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  963. else
  964. {
  965. int num_to_read =
  966. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  967. while ( num_to_read <= 0 )
  968. { /* Not enough room in the buffer - grow it. */
  969. YY_FATAL_ERROR(
  970. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  971. }
  972. if ( num_to_read > YY_READ_BUF_SIZE )
  973. num_to_read = YY_READ_BUF_SIZE;
  974. /* Read in more data. */
  975. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  976. (yy_n_chars), (size_t) num_to_read );
  977. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  978. }
  979. if ( (yy_n_chars) == 0 )
  980. {
  981. if ( number_to_move == YY_MORE_ADJ )
  982. {
  983. ret_val = EOB_ACT_END_OF_FILE;
  984. yyrestart(yyin );
  985. }
  986. else
  987. {
  988. ret_val = EOB_ACT_LAST_MATCH;
  989. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  990. YY_BUFFER_EOF_PENDING;
  991. }
  992. }
  993. else
  994. ret_val = EOB_ACT_CONTINUE_SCAN;
  995. if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  996. /* Extend the array by 50%, plus the number we really need. */
  997. yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  998. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
  999. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1000. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1001. }
  1002. (yy_n_chars) += number_to_move;
  1003. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1004. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1005. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1006. return ret_val;
  1007. }
  1008. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1009. static yy_state_type yy_get_previous_state (void)
  1010. {
  1011. register yy_state_type yy_current_state;
  1012. register char *yy_cp;
  1013. yy_current_state = (yy_start);
  1014. (yy_state_ptr) = (yy_state_buf);
  1015. *(yy_state_ptr)++ = yy_current_state;
  1016. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1017. {
  1018. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1019. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1020. {
  1021. yy_current_state = (int) yy_def[yy_current_state];
  1022. if ( yy_current_state >= 200 )
  1023. yy_c = yy_meta[(unsigned int) yy_c];
  1024. }
  1025. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1026. *(yy_state_ptr)++ = yy_current_state;
  1027. }
  1028. return yy_current_state;
  1029. }
  1030. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1031. *
  1032. * synopsis
  1033. * next_state = yy_try_NUL_trans( current_state );
  1034. */
  1035. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  1036. {
  1037. register int yy_is_jam;
  1038. register YY_CHAR yy_c = 1;
  1039. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1040. {
  1041. yy_current_state = (int) yy_def[yy_current_state];
  1042. if ( yy_current_state >= 200 )
  1043. yy_c = yy_meta[(unsigned int) yy_c];
  1044. }
  1045. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1046. yy_is_jam = (yy_current_state == 199);
  1047. if ( ! yy_is_jam )
  1048. *(yy_state_ptr)++ = yy_current_state;
  1049. return yy_is_jam ? 0 : yy_current_state;
  1050. }
  1051. static void yyunput (int c, register char * yy_bp )
  1052. {
  1053. register char *yy_cp;
  1054. yy_cp = (yy_c_buf_p);
  1055. /* undo effects of setting up yytext */
  1056. *yy_cp = (yy_hold_char);
  1057. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1058. { /* need to shift things up to make room */
  1059. /* +2 for EOB chars. */
  1060. register int number_to_move = (yy_n_chars) + 2;
  1061. register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  1062. YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  1063. register char *source =
  1064. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  1065. while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1066. *--dest = *--source;
  1067. yy_cp += (int) (dest - source);
  1068. yy_bp += (int) (dest - source);
  1069. YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  1070. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  1071. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1072. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1073. }
  1074. *--yy_cp = (char) c;
  1075. (yytext_ptr) = yy_bp;
  1076. (yy_hold_char) = *yy_cp;
  1077. (yy_c_buf_p) = yy_cp;
  1078. }
  1079. #ifndef YY_NO_INPUT
  1080. #ifdef __cplusplus
  1081. static int yyinput (void)
  1082. #else
  1083. static int input (void)
  1084. #endif
  1085. {
  1086. int c;
  1087. *(yy_c_buf_p) = (yy_hold_char);
  1088. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1089. {
  1090. /* yy_c_buf_p now points to the character we want to return.
  1091. * If this occurs *before* the EOB characters, then it's a
  1092. * valid NUL; if not, then we've hit the end of the buffer.
  1093. */
  1094. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1095. /* This was really a NUL. */
  1096. *(yy_c_buf_p) = '\0';
  1097. else
  1098. { /* need more input */
  1099. int offset = (yy_c_buf_p) - (yytext_ptr);
  1100. ++(yy_c_buf_p);
  1101. switch ( yy_get_next_buffer( ) )
  1102. {
  1103. case EOB_ACT_LAST_MATCH:
  1104. /* This happens because yy_g_n_b()
  1105. * sees that we've accumulated a
  1106. * token and flags that we need to
  1107. * try matching the token before
  1108. * proceeding. But for input(),
  1109. * there's no matching to consider.
  1110. * So convert the EOB_ACT_LAST_MATCH
  1111. * to EOB_ACT_END_OF_FILE.
  1112. */
  1113. /* Reset buffer status. */
  1114. yyrestart(yyin );
  1115. /*FALLTHROUGH*/
  1116. case EOB_ACT_END_OF_FILE:
  1117. {
  1118. if ( yywrap( ) )
  1119. return EOF;
  1120. if ( ! (yy_did_buffer_switch_on_eof) )
  1121. YY_NEW_FILE;
  1122. #ifdef __cplusplus
  1123. return yyinput();
  1124. #else
  1125. return input();
  1126. #endif
  1127. }
  1128. case EOB_ACT_CONTINUE_SCAN:
  1129. (yy_c_buf_p) = (yytext_ptr) + offset;
  1130. break;
  1131. }
  1132. }
  1133. }
  1134. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1135. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1136. (yy_hold_char) = *++(yy_c_buf_p);
  1137. return c;
  1138. }
  1139. #endif /* ifndef YY_NO_INPUT */
  1140. /** Immediately switch to a different input stream.
  1141. * @param input_file A readable stream.
  1142. *
  1143. * @note This function does not reset the start condition to @c INITIAL .
  1144. */
  1145. void yyrestart (FILE * input_file )
  1146. {
  1147. if ( ! YY_CURRENT_BUFFER ){
  1148. yyensure_buffer_stack ();
  1149. YY_CURRENT_BUFFER_LVALUE =
  1150. yy_create_buffer(yyin,YY_BUF_SIZE );
  1151. }
  1152. yy_init_buffer(YY_CURRENT_BUFFER,input_file );
  1153. yy_load_buffer_state( );
  1154. }
  1155. /** Switch to a different input buffer.
  1156. * @param new_buffer The new input buffer.
  1157. *
  1158. */
  1159. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
  1160. {
  1161. /* TODO. We should be able to replace this entire function body
  1162. * with
  1163. * yypop_buffer_state();
  1164. * yypush_buffer_state(new_buffer);
  1165. */
  1166. yyensure_buffer_stack ();
  1167. if ( YY_CURRENT_BUFFER == new_buffer )
  1168. return;
  1169. if ( YY_CURRENT_BUFFER )
  1170. {
  1171. /* Flush out information for old buffer. */
  1172. *(yy_c_buf_p) = (yy_hold_char);
  1173. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1174. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1175. }
  1176. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1177. yy_load_buffer_state( );
  1178. /* We don't actually know whether we did this switch during
  1179. * EOF (yywrap()) processing, but the only time this flag
  1180. * is looked at is after yywrap() is called, so it's safe
  1181. * to go ahead and always set it.
  1182. */
  1183. (yy_did_buffer_switch_on_eof) = 1;
  1184. }
  1185. static void yy_load_buffer_state (void)
  1186. {
  1187. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1188. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1189. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1190. (yy_hold_char) = *(yy_c_buf_p);
  1191. }
  1192. /** Allocate and initialize an input buffer state.
  1193. * @param file A readable stream.
  1194. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1195. *
  1196. * @return the allocated buffer state.
  1197. */
  1198. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
  1199. {
  1200. YY_BUFFER_STATE b;
  1201. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1202. if ( ! b )
  1203. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1204. b->yy_buf_size = size;
  1205. /* yy_ch_buf has to be 2 characters longer than the size given because
  1206. * we need to put in 2 end-of-buffer characters.
  1207. */
  1208. b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
  1209. if ( ! b->yy_ch_buf )
  1210. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1211. b->yy_is_our_buffer = 1;
  1212. yy_init_buffer(b,file );
  1213. return b;
  1214. }
  1215. /** Destroy the buffer.
  1216. * @param b a buffer created with yy_create_buffer()
  1217. *
  1218. */
  1219. void yy_delete_buffer (YY_BUFFER_STATE b )
  1220. {
  1221. if ( ! b )
  1222. return;
  1223. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1224. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1225. if ( b->yy_is_our_buffer )
  1226. yyfree((void *) b->yy_ch_buf );
  1227. yyfree((void *) b );
  1228. }
  1229. #ifndef __cplusplus
  1230. extern int isatty (int );
  1231. #endif /* __cplusplus */
  1232. /* Initializes or reinitializes a buffer.
  1233. * This function is sometimes called more than once on the same buffer,
  1234. * such as during a yyrestart() or at EOF.
  1235. */
  1236. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
  1237. {
  1238. int oerrno = errno;
  1239. yy_flush_buffer(b );
  1240. b->yy_input_file = file;
  1241. b->yy_fill_buffer = 1;
  1242. /* If b is the current buffer, then yy_init_buffer was _probably_
  1243. * called from yyrestart() or through yy_get_next_buffer.
  1244. * In that case, we don't want to reset the lineno or column.
  1245. */
  1246. if (b != YY_CURRENT_BUFFER){
  1247. b->yy_bs_lineno = 1;
  1248. b->yy_bs_column = 0;
  1249. }
  1250. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1251. errno = oerrno;
  1252. }
  1253. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1254. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1255. *
  1256. */
  1257. void yy_flush_buffer (YY_BUFFER_STATE b )
  1258. {
  1259. if ( ! b )
  1260. return;
  1261. b->yy_n_chars = 0;
  1262. /* We always need two end-of-buffer characters. The first causes
  1263. * a transition to the end-of-buffer state. The second causes
  1264. * a jam in that state.
  1265. */
  1266. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1267. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1268. b->yy_buf_pos = &b->yy_ch_buf[0];
  1269. b->yy_at_bol = 1;
  1270. b->yy_buffer_status = YY_BUFFER_NEW;
  1271. if ( b == YY_CURRENT_BUFFER )
  1272. yy_load_buffer_state( );
  1273. }
  1274. /** Pushes the new state onto the stack. The new state becomes
  1275. * the current state. This function will allocate the stack
  1276. * if necessary.
  1277. * @param new_buffer The new state.
  1278. *
  1279. */
  1280. void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
  1281. {
  1282. if (new_buffer == NULL)
  1283. return;
  1284. yyensure_buffer_stack();
  1285. /* This block is copied from yy_switch_to_buffer. */
  1286. if ( YY_CURRENT_BUFFER )
  1287. {
  1288. /* Flush out information for old buffer. */
  1289. *(yy_c_buf_p) = (yy_hold_char);
  1290. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1291. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1292. }
  1293. /* Only push if top exists. Otherwise, replace top. */
  1294. if (YY_CURRENT_BUFFER)
  1295. (yy_buffer_stack_top)++;
  1296. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1297. /* copied from yy_switch_to_buffer. */
  1298. yy_load_buffer_state( );
  1299. (yy_did_buffer_switch_on_eof) = 1;
  1300. }
  1301. /** Removes and deletes the top of the stack, if present.
  1302. * The next element becomes the new top.
  1303. *
  1304. */
  1305. void yypop_buffer_state (void)
  1306. {
  1307. if (!YY_CURRENT_BUFFER)
  1308. return;
  1309. yy_delete_buffer(YY_CURRENT_BUFFER );
  1310. YY_CURRENT_BUFFER_LVALUE = NULL;
  1311. if ((yy_buffer_stack_top) > 0)
  1312. --(yy_buffer_stack_top);
  1313. if (YY_CURRENT_BUFFER) {
  1314. yy_load_buffer_state( );
  1315. (yy_did_buffer_switch_on_eof) = 1;
  1316. }
  1317. }
  1318. /* Allocates the stack if it does not exist.
  1319. * Guarantees space for at least one push.
  1320. */
  1321. static void yyensure_buffer_stack (void)
  1322. {
  1323. int num_to_alloc;
  1324. if (!(yy_buffer_stack)) {
  1325. /* First allocation is just for 2 elements, since we don't know if this
  1326. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1327. * immediate realloc on the next call.
  1328. */
  1329. num_to_alloc = 1;
  1330. (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
  1331. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1332. );
  1333. if ( ! (yy_buffer_stack) )
  1334. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1335. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1336. (yy_buffer_stack_max) = num_to_alloc;
  1337. (yy_buffer_stack_top) = 0;
  1338. return;
  1339. }
  1340. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1341. /* Increase the buffer to prepare for a possible push. */
  1342. int grow_size = 8 /* arbitrary grow size */;
  1343. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1344. (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
  1345. ((yy_buffer_stack),
  1346. num_to_alloc * sizeof(struct yy_buffer_state*)
  1347. );
  1348. if ( ! (yy_buffer_stack) )
  1349. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1350. /* zero only the new slots.*/
  1351. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1352. (yy_buffer_stack_max) = num_to_alloc;
  1353. }
  1354. }
  1355. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1356. * @param base the character buffer
  1357. * @param size the size in bytes of the character buffer
  1358. *
  1359. * @return the newly allocated buffer state object.
  1360. */
  1361. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
  1362. {
  1363. YY_BUFFER_STATE b;
  1364. if ( size < 2 ||
  1365. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1366. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1367. /* They forgot to leave room for the EOB's. */
  1368. return 0;
  1369. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1370. if ( ! b )
  1371. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1372. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1373. b->yy_buf_pos = b->yy_ch_buf = base;
  1374. b->yy_is_our_buffer = 0;
  1375. b->yy_input_file = 0;
  1376. b->yy_n_chars = b->yy_buf_size;
  1377. b->yy_is_interactive = 0;
  1378. b->yy_at_bol = 1;
  1379. b->yy_fill_buffer = 0;
  1380. b->yy_buffer_status = YY_BUFFER_NEW;
  1381. yy_switch_to_buffer(b );
  1382. return b;
  1383. }
  1384. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1385. * scan from a @e copy of @a str.
  1386. * @param yystr a NUL-terminated string to scan
  1387. *
  1388. * @return the newly allocated buffer state object.
  1389. * @note If you want to scan bytes that may contain NUL values, then use
  1390. * yy_scan_bytes() instead.
  1391. */
  1392. YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
  1393. {
  1394. return yy_scan_bytes(yystr,strlen(yystr) );
  1395. }
  1396. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1397. * scan from a @e copy of @a bytes.
  1398. * @param bytes the byte buffer to scan
  1399. * @param len the number of bytes in the buffer pointed to by @a bytes.
  1400. *
  1401. * @return the newly allocated buffer state object.
  1402. */
  1403. YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
  1404. {
  1405. YY_BUFFER_STATE b;
  1406. char *buf;
  1407. yy_size_t n;
  1408. int i;
  1409. /* Get memory for full buffer, including space for trailing EOB's. */
  1410. n = _yybytes_len + 2;
  1411. buf = (char *) yyalloc(n );
  1412. if ( ! buf )
  1413. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1414. for ( i = 0; i < _yybytes_len; ++i )
  1415. buf[i] = yybytes[i];
  1416. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1417. b = yy_scan_buffer(buf,n );
  1418. if ( ! b )
  1419. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1420. /* It's okay to grow etc. this buffer, and we should throw it
  1421. * away when we're done.
  1422. */
  1423. b->yy_is_our_buffer = 1;
  1424. return b;
  1425. }
  1426. #ifndef YY_EXIT_FAILURE
  1427. #define YY_EXIT_FAILURE 2
  1428. #endif
  1429. static void yy_fatal_error (yyconst char* msg )
  1430. {
  1431. (void) fprintf( stderr, "%s\n", msg );
  1432. exit( YY_EXIT_FAILURE );
  1433. }
  1434. /* Redefine yyless() so it works in section 3 code. */
  1435. #undef yyless
  1436. #define yyless(n) \
  1437. do \
  1438. { \
  1439. /* Undo effects of setting up yytext. */ \
  1440. int yyless_macro_arg = (n); \
  1441. YY_LESS_LINENO(yyless_macro_arg);\
  1442. yytext[yyleng] = (yy_hold_char); \
  1443. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1444. (yy_hold_char) = *(yy_c_buf_p); \
  1445. *(yy_c_buf_p) = '\0'; \
  1446. yyleng = yyless_macro_arg; \
  1447. } \
  1448. while ( 0 )
  1449. /* Accessor methods (get/set functions) to struct members. */
  1450. /** Get the current line number.
  1451. *
  1452. */
  1453. int yyget_lineno (void)
  1454. {
  1455. return yylineno;
  1456. }
  1457. /** Get the input stream.
  1458. *
  1459. */
  1460. FILE *yyget_in (void)
  1461. {
  1462. return yyin;
  1463. }
  1464. /** Get the output stream.
  1465. *
  1466. */
  1467. FILE *yyget_out (void)
  1468. {
  1469. return yyout;
  1470. }
  1471. /** Get the length of the current token.
  1472. *
  1473. */
  1474. int yyget_leng (void)
  1475. {
  1476. return yyleng;
  1477. }
  1478. /** Get the current token.
  1479. *
  1480. */
  1481. char *yyget_text (void)
  1482. {
  1483. return yytext;
  1484. }
  1485. /** Set the current line number.
  1486. * @param line_number
  1487. *
  1488. */
  1489. void yyset_lineno (int line_number )
  1490. {
  1491. yylineno = line_number;
  1492. }
  1493. /** Set the input stream. This does not discard the current
  1494. * input buffer.
  1495. * @param in_str A readable stream.
  1496. *
  1497. * @see yy_switch_to_buffer
  1498. */
  1499. void yyset_in (FILE * in_str )
  1500. {
  1501. yyin = in_str ;
  1502. }
  1503. void yyset_out (FILE * out_str )
  1504. {
  1505. yyout = out_str ;
  1506. }
  1507. int yyget_debug (void)
  1508. {
  1509. return yy_flex_debug;
  1510. }
  1511. void yyset_debug (int bdebug )
  1512. {
  1513. yy_flex_debug = bdebug ;
  1514. }
  1515. static int yy_init_globals (void)
  1516. {
  1517. /* Initialization is the same as for the non-reentrant scanner.
  1518. * This function is called from yylex_destroy(), so don't allocate here.
  1519. */
  1520. (yy_buffer_stack) = 0;
  1521. (yy_buffer_stack_top) = 0;
  1522. (yy_buffer_stack_max) = 0;
  1523. (yy_c_buf_p) = (char *) 0;
  1524. (yy_init) = 0;
  1525. (yy_start) = 0;
  1526. (yy_state_buf) = 0;
  1527. (yy_state_ptr) = 0;
  1528. (yy_full_match) = 0;
  1529. (yy_lp) = 0;
  1530. /* Defined in main.c */
  1531. #ifdef YY_STDINIT
  1532. yyin = stdin;
  1533. yyout = stdout;
  1534. #else
  1535. yyin = (FILE *) 0;
  1536. yyout = (FILE *) 0;
  1537. #endif
  1538. /* For future reference: Set errno on error, since we are called by
  1539. * yylex_init()
  1540. */
  1541. return 0;
  1542. }
  1543. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1544. int yylex_destroy (void)
  1545. {
  1546. /* Pop the buffer stack, destroying each element. */
  1547. while(YY_CURRENT_BUFFER){
  1548. yy_delete_buffer(YY_CURRENT_BUFFER );
  1549. YY_CURRENT_BUFFER_LVALUE = NULL;
  1550. yypop_buffer_state();
  1551. }
  1552. /* Destroy the stack itself. */
  1553. yyfree((yy_buffer_stack) );
  1554. (yy_buffer_stack) = NULL;
  1555. yyfree ( (yy_state_buf) );
  1556. (yy_state_buf) = NULL;
  1557. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1558. * yylex() is called, initialization will occur. */
  1559. yy_init_globals( );
  1560. return 0;
  1561. }
  1562. /*
  1563. * Internal utility routines.
  1564. */
  1565. #ifndef yytext_ptr
  1566. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  1567. {
  1568. register int i;
  1569. for ( i = 0; i < n; ++i )
  1570. s1[i] = s2[i];
  1571. }
  1572. #endif
  1573. #ifdef YY_NEED_STRLEN
  1574. static int yy_flex_strlen (yyconst char * s )
  1575. {
  1576. register int n;
  1577. for ( n = 0; s[n]; ++n )
  1578. ;
  1579. return n;
  1580. }
  1581. #endif
  1582. void *yyalloc (yy_size_t size )
  1583. {
  1584. return (void *) malloc( size );
  1585. }
  1586. void *yyrealloc (void * ptr, yy_size_t size )
  1587. {
  1588. /* The cast to (char *) in the following accommodates both
  1589. * implementations that use char* generic pointers, and those
  1590. * that use void* generic pointers. It works with the latter
  1591. * because both ANSI C and C++ allow castless assignment from
  1592. * any pointer type to void*, and deal with argument conversions
  1593. * as though doing an assignment.
  1594. */
  1595. return (void *) realloc( (char *) ptr, size );
  1596. }
  1597. void yyfree (void * ptr )
  1598. {
  1599. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  1600. }
  1601. #define YYTABLES_NAME "yytables"
  1602. #line 16 "fclassify.flex"
  1603. #include "SVMUtil.h"
  1604. #include "../thirdparty/libsvm/svm.h"
  1605. #include <iostream>
  1606. #include <string>
  1607. main(int argc, char** argv)
  1608. {
  1609. if ( argc < 2 )
  1610. {
  1611. printf( "usage: %s [model filename] \n", argv[0] );
  1612. }
  1613. else
  1614. {
  1615. yylex();
  1616. num_lowers = num_lowers / num_total;
  1617. num_caps = num_caps / num_total;
  1618. num_punct = num_punct / num_total;
  1619. initial_cap = initial_cap / word_count;
  1620. intercap = intercap / word_count;
  1621. word_length = word_count / num_total;
  1622. // Model/scale factor filename (no extension)
  1623. std::string strFilename = argv[1];
  1624. SVMUtil svmutil;
  1625. if(svmutil.Load(strFilename.c_str()))
  1626. {
  1627. const int num_attributes = 8;
  1628. svm_node* node = new svm_node[num_attributes+1];
  1629. for(int i=0; i<num_attributes; i++)
  1630. {
  1631. node[i].index = i+1;
  1632. }
  1633. node[num_attributes].index = -1;
  1634. node[0].value = num_lowers;
  1635. node[1].value = num_caps;
  1636. node[2].value = num_punct;
  1637. node[3].value = repeat_emphasis;
  1638. node[4].value = initial_cap;
  1639. node[5].value = intercap;
  1640. node[6].value = word_length;
  1641. node[7].value = misspell;
  1642. svmutil.ScaleNode(node);
  1643. double dPredictedClass = svm_predict(svmutil.m_pModel, node );
  1644. printf( "%f\n", dPredictedClass);
  1645. }
  1646. }
  1647. }