grammar_cop 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. data/.DS_Store +0 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +8 -0
  5. data/data/.DS_Store +0 -0
  6. data/data/Makefile +511 -0
  7. data/data/Makefile.am +4 -0
  8. data/data/Makefile.in +511 -0
  9. data/data/de/.DS_Store +0 -0
  10. data/data/de/4.0.affix +7 -0
  11. data/data/de/4.0.dict +474 -0
  12. data/data/de/Makefile +387 -0
  13. data/data/de/Makefile.am +9 -0
  14. data/data/de/Makefile.in +387 -0
  15. data/data/en/.DS_Store +0 -0
  16. data/data/en/4.0.affix +26 -0
  17. data/data/en/4.0.batch +1002 -0
  18. data/data/en/4.0.biolg.batch +411 -0
  19. data/data/en/4.0.constituent-knowledge +127 -0
  20. data/data/en/4.0.dict +8759 -0
  21. data/data/en/4.0.dict.m4 +6928 -0
  22. data/data/en/4.0.enwiki.batch +14 -0
  23. data/data/en/4.0.fixes.batch +2776 -0
  24. data/data/en/4.0.knowledge +306 -0
  25. data/data/en/4.0.regex +225 -0
  26. data/data/en/4.0.voa.batch +114 -0
  27. data/data/en/Makefile +554 -0
  28. data/data/en/Makefile.am +19 -0
  29. data/data/en/Makefile.in +554 -0
  30. data/data/en/README +173 -0
  31. data/data/en/tiny.dict +157 -0
  32. data/data/en/words/.DS_Store +0 -0
  33. data/data/en/words/Makefile +456 -0
  34. data/data/en/words/Makefile.am +78 -0
  35. data/data/en/words/Makefile.in +456 -0
  36. data/data/en/words/currency +205 -0
  37. data/data/en/words/currency.p +28 -0
  38. data/data/en/words/entities.given-bisex.sing +39 -0
  39. data/data/en/words/entities.given-female.sing +4141 -0
  40. data/data/en/words/entities.given-male.sing +1633 -0
  41. data/data/en/words/entities.locations.sing +68 -0
  42. data/data/en/words/entities.national.sing +253 -0
  43. data/data/en/words/entities.organizations.sing +7 -0
  44. data/data/en/words/entities.us-states.sing +11 -0
  45. data/data/en/words/units.1 +45 -0
  46. data/data/en/words/units.1.dot +4 -0
  47. data/data/en/words/units.3 +2 -0
  48. data/data/en/words/units.4 +5 -0
  49. data/data/en/words/units.4.dot +1 -0
  50. data/data/en/words/words-medical.adv.1 +1191 -0
  51. data/data/en/words/words-medical.prep.1 +67 -0
  52. data/data/en/words/words-medical.v.4.1 +2835 -0
  53. data/data/en/words/words-medical.v.4.2 +2848 -0
  54. data/data/en/words/words-medical.v.4.3 +3011 -0
  55. data/data/en/words/words-medical.v.4.4 +3036 -0
  56. data/data/en/words/words-medical.v.4.5 +3050 -0
  57. data/data/en/words/words.adj.1 +6794 -0
  58. data/data/en/words/words.adj.2 +638 -0
  59. data/data/en/words/words.adj.3 +667 -0
  60. data/data/en/words/words.adv.1 +1573 -0
  61. data/data/en/words/words.adv.2 +67 -0
  62. data/data/en/words/words.adv.3 +157 -0
  63. data/data/en/words/words.adv.4 +80 -0
  64. data/data/en/words/words.n.1 +11464 -0
  65. data/data/en/words/words.n.1.wiki +264 -0
  66. data/data/en/words/words.n.2.s +2017 -0
  67. data/data/en/words/words.n.2.s.biolg +1 -0
  68. data/data/en/words/words.n.2.s.wiki +298 -0
  69. data/data/en/words/words.n.2.x +65 -0
  70. data/data/en/words/words.n.2.x.wiki +10 -0
  71. data/data/en/words/words.n.3 +5717 -0
  72. data/data/en/words/words.n.t +23 -0
  73. data/data/en/words/words.v.1.1 +1038 -0
  74. data/data/en/words/words.v.1.2 +1043 -0
  75. data/data/en/words/words.v.1.3 +1052 -0
  76. data/data/en/words/words.v.1.4 +1023 -0
  77. data/data/en/words/words.v.1.p +17 -0
  78. data/data/en/words/words.v.10.1 +14 -0
  79. data/data/en/words/words.v.10.2 +15 -0
  80. data/data/en/words/words.v.10.3 +88 -0
  81. data/data/en/words/words.v.10.4 +17 -0
  82. data/data/en/words/words.v.2.1 +1253 -0
  83. data/data/en/words/words.v.2.2 +1304 -0
  84. data/data/en/words/words.v.2.3 +1280 -0
  85. data/data/en/words/words.v.2.4 +1285 -0
  86. data/data/en/words/words.v.2.5 +1287 -0
  87. data/data/en/words/words.v.4.1 +2472 -0
  88. data/data/en/words/words.v.4.2 +2487 -0
  89. data/data/en/words/words.v.4.3 +2441 -0
  90. data/data/en/words/words.v.4.4 +2478 -0
  91. data/data/en/words/words.v.4.5 +2483 -0
  92. data/data/en/words/words.v.5.1 +98 -0
  93. data/data/en/words/words.v.5.2 +98 -0
  94. data/data/en/words/words.v.5.3 +103 -0
  95. data/data/en/words/words.v.5.4 +102 -0
  96. data/data/en/words/words.v.6.1 +388 -0
  97. data/data/en/words/words.v.6.2 +401 -0
  98. data/data/en/words/words.v.6.3 +397 -0
  99. data/data/en/words/words.v.6.4 +405 -0
  100. data/data/en/words/words.v.6.5 +401 -0
  101. data/data/en/words/words.v.8.1 +117 -0
  102. data/data/en/words/words.v.8.2 +118 -0
  103. data/data/en/words/words.v.8.3 +118 -0
  104. data/data/en/words/words.v.8.4 +119 -0
  105. data/data/en/words/words.v.8.5 +119 -0
  106. data/data/en/words/words.y +104 -0
  107. data/data/lt/.DS_Store +0 -0
  108. data/data/lt/4.0.affix +6 -0
  109. data/data/lt/4.0.constituent-knowledge +24 -0
  110. data/data/lt/4.0.dict +135 -0
  111. data/data/lt/4.0.knowledge +38 -0
  112. data/data/lt/Makefile +389 -0
  113. data/data/lt/Makefile.am +11 -0
  114. data/data/lt/Makefile.in +389 -0
  115. data/ext/.DS_Store +0 -0
  116. data/ext/link_grammar/.DS_Store +0 -0
  117. data/ext/link_grammar/extconf.rb +2 -0
  118. data/ext/link_grammar/link-grammar/.DS_Store +0 -0
  119. data/ext/link_grammar/link-grammar/.deps/analyze-linkage.Plo +198 -0
  120. data/ext/link_grammar/link-grammar/.deps/and.Plo +202 -0
  121. data/ext/link_grammar/link-grammar/.deps/api.Plo +244 -0
  122. data/ext/link_grammar/link-grammar/.deps/build-disjuncts.Plo +212 -0
  123. data/ext/link_grammar/link-grammar/.deps/command-line.Plo +201 -0
  124. data/ext/link_grammar/link-grammar/.deps/constituents.Plo +201 -0
  125. data/ext/link_grammar/link-grammar/.deps/count.Plo +202 -0
  126. data/ext/link_grammar/link-grammar/.deps/disjunct-utils.Plo +126 -0
  127. data/ext/link_grammar/link-grammar/.deps/disjuncts.Plo +123 -0
  128. data/ext/link_grammar/link-grammar/.deps/error.Plo +121 -0
  129. data/ext/link_grammar/link-grammar/.deps/expand.Plo +133 -0
  130. data/ext/link_grammar/link-grammar/.deps/extract-links.Plo +198 -0
  131. data/ext/link_grammar/link-grammar/.deps/fast-match.Plo +200 -0
  132. data/ext/link_grammar/link-grammar/.deps/idiom.Plo +200 -0
  133. data/ext/link_grammar/link-grammar/.deps/jni-client.Plo +217 -0
  134. data/ext/link_grammar/link-grammar/.deps/link-parser.Po +1 -0
  135. data/ext/link_grammar/link-grammar/.deps/massage.Plo +202 -0
  136. data/ext/link_grammar/link-grammar/.deps/post-process.Plo +202 -0
  137. data/ext/link_grammar/link-grammar/.deps/pp_knowledge.Plo +202 -0
  138. data/ext/link_grammar/link-grammar/.deps/pp_lexer.Plo +201 -0
  139. data/ext/link_grammar/link-grammar/.deps/pp_linkset.Plo +200 -0
  140. data/ext/link_grammar/link-grammar/.deps/prefix.Plo +102 -0
  141. data/ext/link_grammar/link-grammar/.deps/preparation.Plo +202 -0
  142. data/ext/link_grammar/link-grammar/.deps/print-util.Plo +200 -0
  143. data/ext/link_grammar/link-grammar/.deps/print.Plo +201 -0
  144. data/ext/link_grammar/link-grammar/.deps/prune.Plo +202 -0
  145. data/ext/link_grammar/link-grammar/.deps/read-dict.Plo +223 -0
  146. data/ext/link_grammar/link-grammar/.deps/read-regex.Plo +123 -0
  147. data/ext/link_grammar/link-grammar/.deps/regex-morph.Plo +131 -0
  148. data/ext/link_grammar/link-grammar/.deps/resources.Plo +203 -0
  149. data/ext/link_grammar/link-grammar/.deps/spellcheck-aspell.Plo +1 -0
  150. data/ext/link_grammar/link-grammar/.deps/spellcheck-hun.Plo +115 -0
  151. data/ext/link_grammar/link-grammar/.deps/string-set.Plo +198 -0
  152. data/ext/link_grammar/link-grammar/.deps/tokenize.Plo +160 -0
  153. data/ext/link_grammar/link-grammar/.deps/utilities.Plo +222 -0
  154. data/ext/link_grammar/link-grammar/.deps/word-file.Plo +201 -0
  155. data/ext/link_grammar/link-grammar/.deps/word-utils.Plo +212 -0
  156. data/ext/link_grammar/link-grammar/.libs/analyze-linkage.o +0 -0
  157. data/ext/link_grammar/link-grammar/.libs/and.o +0 -0
  158. data/ext/link_grammar/link-grammar/.libs/api.o +0 -0
  159. data/ext/link_grammar/link-grammar/.libs/build-disjuncts.o +0 -0
  160. data/ext/link_grammar/link-grammar/.libs/command-line.o +0 -0
  161. data/ext/link_grammar/link-grammar/.libs/constituents.o +0 -0
  162. data/ext/link_grammar/link-grammar/.libs/count.o +0 -0
  163. data/ext/link_grammar/link-grammar/.libs/disjunct-utils.o +0 -0
  164. data/ext/link_grammar/link-grammar/.libs/disjuncts.o +0 -0
  165. data/ext/link_grammar/link-grammar/.libs/error.o +0 -0
  166. data/ext/link_grammar/link-grammar/.libs/expand.o +0 -0
  167. data/ext/link_grammar/link-grammar/.libs/extract-links.o +0 -0
  168. data/ext/link_grammar/link-grammar/.libs/fast-match.o +0 -0
  169. data/ext/link_grammar/link-grammar/.libs/idiom.o +0 -0
  170. data/ext/link_grammar/link-grammar/.libs/jni-client.o +0 -0
  171. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java-symbols.expsym +31 -0
  172. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.4.dylib +0 -0
  173. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.4.dylib.dSYM/Contents/Info.plist +20 -0
  174. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.4.dylib.dSYM/Contents/Resources/DWARF/liblink-grammar-java.4.dylib +0 -0
  175. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.a +0 -0
  176. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-java.dylib +0 -0
  177. data/ext/link_grammar/link-grammar/.libs/liblink-grammar-symbols.expsym +194 -0
  178. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.4.dylib +0 -0
  179. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.4.dylib.dSYM/Contents/Info.plist +20 -0
  180. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.4.dylib.dSYM/Contents/Resources/DWARF/liblink-grammar.4.dylib +0 -0
  181. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.a +0 -0
  182. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.dylib +0 -0
  183. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.la +41 -0
  184. data/ext/link_grammar/link-grammar/.libs/liblink-grammar.lai +41 -0
  185. data/ext/link_grammar/link-grammar/.libs/massage.o +0 -0
  186. data/ext/link_grammar/link-grammar/.libs/post-process.o +0 -0
  187. data/ext/link_grammar/link-grammar/.libs/pp_knowledge.o +0 -0
  188. data/ext/link_grammar/link-grammar/.libs/pp_lexer.o +0 -0
  189. data/ext/link_grammar/link-grammar/.libs/pp_linkset.o +0 -0
  190. data/ext/link_grammar/link-grammar/.libs/prefix.o +0 -0
  191. data/ext/link_grammar/link-grammar/.libs/preparation.o +0 -0
  192. data/ext/link_grammar/link-grammar/.libs/print-util.o +0 -0
  193. data/ext/link_grammar/link-grammar/.libs/print.o +0 -0
  194. data/ext/link_grammar/link-grammar/.libs/prune.o +0 -0
  195. data/ext/link_grammar/link-grammar/.libs/read-dict.o +0 -0
  196. data/ext/link_grammar/link-grammar/.libs/read-regex.o +0 -0
  197. data/ext/link_grammar/link-grammar/.libs/regex-morph.o +0 -0
  198. data/ext/link_grammar/link-grammar/.libs/resources.o +0 -0
  199. data/ext/link_grammar/link-grammar/.libs/spellcheck-aspell.o +0 -0
  200. data/ext/link_grammar/link-grammar/.libs/spellcheck-hun.o +0 -0
  201. data/ext/link_grammar/link-grammar/.libs/string-set.o +0 -0
  202. data/ext/link_grammar/link-grammar/.libs/tokenize.o +0 -0
  203. data/ext/link_grammar/link-grammar/.libs/utilities.o +0 -0
  204. data/ext/link_grammar/link-grammar/.libs/word-file.o +0 -0
  205. data/ext/link_grammar/link-grammar/.libs/word-utils.o +0 -0
  206. data/ext/link_grammar/link-grammar/Makefile +900 -0
  207. data/ext/link_grammar/link-grammar/Makefile.am +202 -0
  208. data/ext/link_grammar/link-grammar/Makefile.in +900 -0
  209. data/ext/link_grammar/link-grammar/analyze-linkage.c +1317 -0
  210. data/ext/link_grammar/link-grammar/analyze-linkage.h +24 -0
  211. data/ext/link_grammar/link-grammar/and.c +1603 -0
  212. data/ext/link_grammar/link-grammar/and.h +27 -0
  213. data/ext/link_grammar/link-grammar/api-structures.h +362 -0
  214. data/ext/link_grammar/link-grammar/api-types.h +72 -0
  215. data/ext/link_grammar/link-grammar/api.c +1887 -0
  216. data/ext/link_grammar/link-grammar/api.h +96 -0
  217. data/ext/link_grammar/link-grammar/autoit/.DS_Store +0 -0
  218. data/ext/link_grammar/link-grammar/autoit/README +10 -0
  219. data/ext/link_grammar/link-grammar/autoit/_LGTest.au3 +22 -0
  220. data/ext/link_grammar/link-grammar/autoit/_LinkGrammar.au3 +545 -0
  221. data/ext/link_grammar/link-grammar/build-disjuncts.c +487 -0
  222. data/ext/link_grammar/link-grammar/build-disjuncts.h +21 -0
  223. data/ext/link_grammar/link-grammar/command-line.c +458 -0
  224. data/ext/link_grammar/link-grammar/command-line.h +15 -0
  225. data/ext/link_grammar/link-grammar/constituents.c +1836 -0
  226. data/ext/link_grammar/link-grammar/constituents.h +26 -0
  227. data/ext/link_grammar/link-grammar/corpus/.DS_Store +0 -0
  228. data/ext/link_grammar/link-grammar/corpus/.deps/cluster.Plo +1 -0
  229. data/ext/link_grammar/link-grammar/corpus/.deps/corpus.Plo +1 -0
  230. data/ext/link_grammar/link-grammar/corpus/Makefile +527 -0
  231. data/ext/link_grammar/link-grammar/corpus/Makefile.am +46 -0
  232. data/ext/link_grammar/link-grammar/corpus/Makefile.in +527 -0
  233. data/ext/link_grammar/link-grammar/corpus/README +17 -0
  234. data/ext/link_grammar/link-grammar/corpus/cluster.c +286 -0
  235. data/ext/link_grammar/link-grammar/corpus/cluster.h +32 -0
  236. data/ext/link_grammar/link-grammar/corpus/corpus.c +483 -0
  237. data/ext/link_grammar/link-grammar/corpus/corpus.h +46 -0
  238. data/ext/link_grammar/link-grammar/count.c +828 -0
  239. data/ext/link_grammar/link-grammar/count.h +25 -0
  240. data/ext/link_grammar/link-grammar/disjunct-utils.c +261 -0
  241. data/ext/link_grammar/link-grammar/disjunct-utils.h +27 -0
  242. data/ext/link_grammar/link-grammar/disjuncts.c +138 -0
  243. data/ext/link_grammar/link-grammar/disjuncts.h +13 -0
  244. data/ext/link_grammar/link-grammar/error.c +92 -0
  245. data/ext/link_grammar/link-grammar/error.h +35 -0
  246. data/ext/link_grammar/link-grammar/expand.c +67 -0
  247. data/ext/link_grammar/link-grammar/expand.h +13 -0
  248. data/ext/link_grammar/link-grammar/externs.h +22 -0
  249. data/ext/link_grammar/link-grammar/extract-links.c +625 -0
  250. data/ext/link_grammar/link-grammar/extract-links.h +16 -0
  251. data/ext/link_grammar/link-grammar/fast-match.c +309 -0
  252. data/ext/link_grammar/link-grammar/fast-match.h +17 -0
  253. data/ext/link_grammar/link-grammar/idiom.c +373 -0
  254. data/ext/link_grammar/link-grammar/idiom.h +15 -0
  255. data/ext/link_grammar/link-grammar/jni-client.c +779 -0
  256. data/ext/link_grammar/link-grammar/jni-client.h +236 -0
  257. data/ext/link_grammar/link-grammar/liblink-grammar-java.la +42 -0
  258. data/ext/link_grammar/link-grammar/liblink-grammar.la +41 -0
  259. data/ext/link_grammar/link-grammar/link-features.h +37 -0
  260. data/ext/link_grammar/link-grammar/link-features.h.in +37 -0
  261. data/ext/link_grammar/link-grammar/link-grammar-java.def +31 -0
  262. data/ext/link_grammar/link-grammar/link-grammar.def +194 -0
  263. data/ext/link_grammar/link-grammar/link-includes.h +465 -0
  264. data/ext/link_grammar/link-grammar/link-parser.c +849 -0
  265. data/ext/link_grammar/link-grammar/massage.c +329 -0
  266. data/ext/link_grammar/link-grammar/massage.h +13 -0
  267. data/ext/link_grammar/link-grammar/post-process.c +1113 -0
  268. data/ext/link_grammar/link-grammar/post-process.h +45 -0
  269. data/ext/link_grammar/link-grammar/pp_knowledge.c +376 -0
  270. data/ext/link_grammar/link-grammar/pp_knowledge.h +14 -0
  271. data/ext/link_grammar/link-grammar/pp_lexer.c +1920 -0
  272. data/ext/link_grammar/link-grammar/pp_lexer.h +19 -0
  273. data/ext/link_grammar/link-grammar/pp_linkset.c +158 -0
  274. data/ext/link_grammar/link-grammar/pp_linkset.h +20 -0
  275. data/ext/link_grammar/link-grammar/prefix.c +482 -0
  276. data/ext/link_grammar/link-grammar/prefix.h +139 -0
  277. data/ext/link_grammar/link-grammar/preparation.c +412 -0
  278. data/ext/link_grammar/link-grammar/preparation.h +20 -0
  279. data/ext/link_grammar/link-grammar/print-util.c +87 -0
  280. data/ext/link_grammar/link-grammar/print-util.h +32 -0
  281. data/ext/link_grammar/link-grammar/print.c +1085 -0
  282. data/ext/link_grammar/link-grammar/print.h +16 -0
  283. data/ext/link_grammar/link-grammar/prune.c +1864 -0
  284. data/ext/link_grammar/link-grammar/prune.h +17 -0
  285. data/ext/link_grammar/link-grammar/read-dict.c +1785 -0
  286. data/ext/link_grammar/link-grammar/read-dict.h +29 -0
  287. data/ext/link_grammar/link-grammar/read-regex.c +161 -0
  288. data/ext/link_grammar/link-grammar/read-regex.h +12 -0
  289. data/ext/link_grammar/link-grammar/regex-morph.c +126 -0
  290. data/ext/link_grammar/link-grammar/regex-morph.h +17 -0
  291. data/ext/link_grammar/link-grammar/resources.c +180 -0
  292. data/ext/link_grammar/link-grammar/resources.h +23 -0
  293. data/ext/link_grammar/link-grammar/sat-solver/.DS_Store +0 -0
  294. data/ext/link_grammar/link-grammar/sat-solver/.deps/fast-sprintf.Plo +1 -0
  295. data/ext/link_grammar/link-grammar/sat-solver/.deps/sat-encoder.Plo +1 -0
  296. data/ext/link_grammar/link-grammar/sat-solver/.deps/util.Plo +1 -0
  297. data/ext/link_grammar/link-grammar/sat-solver/.deps/variables.Plo +1 -0
  298. data/ext/link_grammar/link-grammar/sat-solver/.deps/word-tag.Plo +1 -0
  299. data/ext/link_grammar/link-grammar/sat-solver/Makefile +527 -0
  300. data/ext/link_grammar/link-grammar/sat-solver/Makefile.am +29 -0
  301. data/ext/link_grammar/link-grammar/sat-solver/Makefile.in +527 -0
  302. data/ext/link_grammar/link-grammar/sat-solver/clock.hpp +33 -0
  303. data/ext/link_grammar/link-grammar/sat-solver/fast-sprintf.cpp +26 -0
  304. data/ext/link_grammar/link-grammar/sat-solver/fast-sprintf.hpp +7 -0
  305. data/ext/link_grammar/link-grammar/sat-solver/guiding.hpp +244 -0
  306. data/ext/link_grammar/link-grammar/sat-solver/matrix-ut.hpp +79 -0
  307. data/ext/link_grammar/link-grammar/sat-solver/sat-encoder.cpp +2811 -0
  308. data/ext/link_grammar/link-grammar/sat-solver/sat-encoder.h +11 -0
  309. data/ext/link_grammar/link-grammar/sat-solver/sat-encoder.hpp +381 -0
  310. data/ext/link_grammar/link-grammar/sat-solver/trie.hpp +118 -0
  311. data/ext/link_grammar/link-grammar/sat-solver/util.cpp +23 -0
  312. data/ext/link_grammar/link-grammar/sat-solver/util.hpp +14 -0
  313. data/ext/link_grammar/link-grammar/sat-solver/variables.cpp +5 -0
  314. data/ext/link_grammar/link-grammar/sat-solver/variables.hpp +829 -0
  315. data/ext/link_grammar/link-grammar/sat-solver/word-tag.cpp +159 -0
  316. data/ext/link_grammar/link-grammar/sat-solver/word-tag.hpp +162 -0
  317. data/ext/link_grammar/link-grammar/spellcheck-aspell.c +148 -0
  318. data/ext/link_grammar/link-grammar/spellcheck-hun.c +136 -0
  319. data/ext/link_grammar/link-grammar/spellcheck.h +34 -0
  320. data/ext/link_grammar/link-grammar/string-set.c +169 -0
  321. data/ext/link_grammar/link-grammar/string-set.h +16 -0
  322. data/ext/link_grammar/link-grammar/structures.h +498 -0
  323. data/ext/link_grammar/link-grammar/tokenize.c +1049 -0
  324. data/ext/link_grammar/link-grammar/tokenize.h +15 -0
  325. data/ext/link_grammar/link-grammar/utilities.c +847 -0
  326. data/ext/link_grammar/link-grammar/utilities.h +281 -0
  327. data/ext/link_grammar/link-grammar/word-file.c +124 -0
  328. data/ext/link_grammar/link-grammar/word-file.h +15 -0
  329. data/ext/link_grammar/link-grammar/word-utils.c +526 -0
  330. data/ext/link_grammar/link-grammar/word-utils.h +152 -0
  331. data/ext/link_grammar/link_grammar.c +202 -0
  332. data/ext/link_grammar/link_grammar.h +99 -0
  333. data/grammar_cop.gemspec +24 -0
  334. data/lib/.DS_Store +0 -0
  335. data/lib/grammar_cop.rb +9 -0
  336. data/lib/grammar_cop/.DS_Store +0 -0
  337. data/lib/grammar_cop/dictionary.rb +19 -0
  338. data/lib/grammar_cop/linkage.rb +30 -0
  339. data/lib/grammar_cop/parse_options.rb +32 -0
  340. data/lib/grammar_cop/sentence.rb +36 -0
  341. data/lib/grammar_cop/version.rb +3 -0
  342. data/test/.DS_Store +0 -0
  343. data/test/grammar_cop_test.rb +27 -0
  344. metadata +407 -0
@@ -0,0 +1,45 @@
1
+ /********************************************************************************/
2
+ /* Copyright (c) 2004 */
3
+ /* Daniel Sleator, David Temperley, and John Lafferty */
4
+ /* All rights reserved */
5
+ /* */
6
+ /* Use of the link grammar parsing system is subject to the terms of the */
7
+ /* license set forth in the LICENSE file included with this software, */
8
+ /* and also available at http://www.link.cs.cmu.edu/link/license.html */
9
+ /* This license allows free redistribution and use in source and binary */
10
+ /* forms, with or without modification, subject to certain conditions. */
11
+ /* */
12
+ /********************************************************************************/
13
+ /**********************************************************************
14
+ Calling paradigm:
15
+ . call post_process_open() with the name of a knowledge file. This
16
+ returns a handle, used for all subsequent calls to post-process.
17
+ . Do for each sentence:
18
+ - Do for each generated linkage of sentence:
19
+ + call post_process_scan_linkage()
20
+ - Do for each generated linkage of sentence:
21
+ + call post_process()
22
+ - Call post_process_close_sentence()
23
+ ***********************************************************************/
24
+
25
+ #ifndef _POSTPROCESSH_
26
+ #define _POSTPROCESSH_
27
+
28
+ #define PP_FIRST_PASS 1
29
+ #define PP_SECOND_PASS 2
30
+
31
+ /* Postprocessor * post_process_open(char *path); this is in api-prototypes.h */
32
+
33
+ void post_process_free_data(PP_data * ppd);
34
+ void post_process_close_sentence(Postprocessor *);
35
+ void post_process_scan_linkage(Postprocessor * pp, Parse_Options opts,
36
+ Sentence sent , Sublinkage * sublinkage);
37
+ PP_node *post_process(Postprocessor * pp, Parse_Options opts,
38
+ Sentence sent, Sublinkage *, int cleanup);
39
+ int post_process_match(const char *s, const char *t); /* utility function */
40
+
41
+ void free_d_type(D_type_list * dtl);
42
+ D_type_list * copy_d_type(D_type_list * dtl);
43
+
44
+
45
+ #endif
@@ -0,0 +1,376 @@
1
+ /*************************************************************************/
2
+ /* Copyright (c) 2004 */
3
+ /* Daniel Sleator, David Temperley, and John Lafferty */
4
+ /* All rights reserved */
5
+ /* */
6
+ /* Use of the link grammar parsing system is subject to the terms of the */
7
+ /* license set forth in the LICENSE file included with this software, */
8
+ /* and also available at http://www.link.cs.cmu.edu/link/license.html */
9
+ /* This license allows free redistribution and use in source and binary */
10
+ /* forms, with or without modification, subject to certain conditions. */
11
+ /* */
12
+ /*************************************************************************/
13
+
14
+ /***********************************************************************
15
+ pp_knowledge.c
16
+ 7/97
17
+ Contains rules and associated information for post processing. This
18
+ information is supplied in a human-readable file and is parsed by
19
+ pp_lexer.h
20
+ ***********************************************************************/
21
+
22
+ #include "api.h"
23
+ #include "error.h"
24
+ #include "utilities.h"
25
+
26
+ #define PP_MAX_UNIQUE_LINK_NAMES 1024 /* just needs to be approximate */
27
+
28
+ /****************** non-exported functions ***************************/
29
+
30
+ static void check_domain_is_legal(const char *p)
31
+ {
32
+ if (0x0 != p[1])
33
+ {
34
+ prt_error("Fatal Error: post_process(): Domain (%s) must be a single character", p);
35
+ exit(1);
36
+ }
37
+ }
38
+
39
+ static void initialize_set_of_links_starting_bounded_domain(pp_knowledge *k)
40
+ {
41
+ int i,j,d,domain_of_rule;
42
+ k->set_of_links_starting_bounded_domain =
43
+ pp_linkset_open(PP_MAX_UNIQUE_LINK_NAMES);
44
+ for (i=0; k->bounded_rules[i].msg!=0; i++)
45
+ {
46
+ domain_of_rule = k->bounded_rules[i].domain;
47
+ for (j=0; (d=(k->starting_link_lookup_table[j].domain))!=-1; j++)
48
+ if (d==domain_of_rule)
49
+ pp_linkset_add(k->set_of_links_starting_bounded_domain,
50
+ k->starting_link_lookup_table[j].starting_link);
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Read table of [link, domain type].
56
+ * This tells us what domain type each link belongs to.
57
+ * This lookup table *must* be defined in the knowledge file.
58
+ */
59
+ static void read_starting_link_table(pp_knowledge *k)
60
+ {
61
+ const char *p;
62
+ const char label[] = "STARTING_LINK_TYPE_TABLE";
63
+ int i, n_tokens;
64
+ if (!pp_lexer_set_label(k->lt, label))
65
+ {
66
+ prt_error("Fatal error: post_process: Couldn't find starting link table %s",label);
67
+ exit(1);
68
+ }
69
+ n_tokens = pp_lexer_count_tokens_of_label(k->lt);
70
+ if (n_tokens %2)
71
+ {
72
+ prt_error("Fatal error: post_process: Link table must have format [<link> <domain name>]+");
73
+ exit(1);
74
+ }
75
+ k->nStartingLinks = n_tokens/2;
76
+ k->starting_link_lookup_table = (StartingLinkAndDomain*)
77
+ xalloc((1+k->nStartingLinks)*sizeof(StartingLinkAndDomain));
78
+ for (i=0; i<k->nStartingLinks; i++)
79
+ {
80
+ /* read the starting link itself */
81
+ k->starting_link_lookup_table[i].starting_link =
82
+ string_set_add(pp_lexer_get_next_token_of_label(k->lt),k->string_set);
83
+
84
+ /* read the domain type of the link */
85
+ p = pp_lexer_get_next_token_of_label(k->lt);
86
+ check_domain_is_legal(p);
87
+ k->starting_link_lookup_table[i].domain = (int) p[0];
88
+ }
89
+
90
+ /* end sentinel */
91
+ k->starting_link_lookup_table[k->nStartingLinks].domain = -1;
92
+ }
93
+
94
+ static pp_linkset *read_link_set(pp_knowledge *k,
95
+ const char *label, String_set *ss)
96
+ {
97
+ /* read link set, marked by label in knowledge file, into a set of links
98
+ whose handle is returned. Return NULL if link set not defined in file,
99
+ in which case the set is taken to be empty. */
100
+ int n_strings,i;
101
+ pp_linkset *ls;
102
+ if (!pp_lexer_set_label(k->lt, label)) {
103
+ if (verbosity>0)
104
+ printf("PP warning: Link set %s not defined: assuming empty.\n",label);
105
+ n_strings = 0;
106
+ }
107
+ else n_strings = pp_lexer_count_tokens_of_label(k->lt);
108
+ ls = pp_linkset_open(n_strings);
109
+ for (i=0; i<n_strings; i++)
110
+ pp_linkset_add(ls,
111
+ string_set_add(pp_lexer_get_next_token_of_label(k->lt),ss));
112
+ return ls;
113
+ }
114
+
115
+ static void read_link_sets(pp_knowledge *k)
116
+ {
117
+ String_set *ss = k->string_set; /* shorthand */
118
+ k->domain_starter_links =read_link_set(k,"DOMAIN_STARTER_LINKS",ss);
119
+ k->urfl_domain_starter_links=read_link_set(k,"URFL_DOMAIN_STARTER_LINKS",ss);
120
+ k->domain_contains_links =read_link_set(k,"DOMAIN_CONTAINS_LINKS",ss);
121
+ k->ignore_these_links =read_link_set(k,"IGNORE_THESE_LINKS",ss);
122
+ k->restricted_links =read_link_set(k,"RESTRICTED_LINKS",ss);
123
+ k->must_form_a_cycle_links =read_link_set(k,"MUST_FORM_A_CYCLE_LINKS",ss);
124
+ k->urfl_only_domain_starter_links=
125
+ read_link_set(k,"URFL_ONLY_DOMAIN_STARTER_LINKS",ss);
126
+ k->left_domain_starter_links=read_link_set(k,"LEFT_DOMAIN_STARTER_LINKS",ss);
127
+ }
128
+
129
+ static void free_link_sets(pp_knowledge *k)
130
+ {
131
+ pp_linkset_close(k->domain_starter_links);
132
+ pp_linkset_close(k->urfl_domain_starter_links);
133
+ pp_linkset_close(k->domain_contains_links);
134
+ pp_linkset_close(k->ignore_these_links);
135
+ pp_linkset_close(k->restricted_links);
136
+ pp_linkset_close(k->must_form_a_cycle_links);
137
+ pp_linkset_close(k->urfl_only_domain_starter_links);
138
+ pp_linkset_close(k->left_domain_starter_links);
139
+ }
140
+
141
+ static void read_connected_rule(pp_knowledge *k, const char *label)
142
+ {
143
+ /* This is a degenerate class of rules: either a single rule asserting
144
+ connectivity is there, or it isn't. The only information in the
145
+ rule (besides its presence) is the error message to display if
146
+ the rule is violated */
147
+ k->connected_rules = (pp_rule *) xalloc (sizeof(pp_rule));
148
+ if (!pp_lexer_set_label(k->lt, label))
149
+ {
150
+ k->connected_rules[0].msg=0; /* rule not there */
151
+ if (verbosity>0) printf("PP warning: Not using 'link is connected' rule\n");
152
+ return;
153
+ }
154
+ if (pp_lexer_count_tokens_of_label(k->lt)>1)
155
+ {
156
+ prt_error("Fatal Error: post_process(): Invalid syntax in %s", label);
157
+ exit(1);
158
+ }
159
+ k->connected_rules[0].msg =
160
+ string_set_add(pp_lexer_get_next_token_of_label(k->lt), k->string_set);
161
+ }
162
+
163
+
164
+ static void read_form_a_cycle_rules(pp_knowledge *k, const char *label)
165
+ {
166
+ int n_commas, n_tokens, r, i;
167
+ pp_linkset *lsHandle;
168
+ const char **tokens;
169
+ if (!pp_lexer_set_label(k->lt, label)) {
170
+ k->n_form_a_cycle_rules = 0;
171
+ if (verbosity>0)
172
+ printf("PP warning: Not using any 'form a cycle' rules\n");
173
+ }
174
+ else {
175
+ n_commas = pp_lexer_count_commas_of_label(k->lt);
176
+ k->n_form_a_cycle_rules = (n_commas + 1)/2;
177
+ }
178
+ k->form_a_cycle_rules=
179
+ (pp_rule*) xalloc ((1+k->n_form_a_cycle_rules)*sizeof(pp_rule));
180
+ for (r=0; r<k->n_form_a_cycle_rules; r++)
181
+ {
182
+ /* read link set */
183
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
184
+ if (n_tokens <= 0)
185
+ {
186
+ prt_error("Fatal Error: syntax error in knowledge file");
187
+ exit(1);
188
+ }
189
+ lsHandle = pp_linkset_open(n_tokens);
190
+ for (i=0; i<n_tokens; i++)
191
+ pp_linkset_add(lsHandle,string_set_add(tokens[i], k->string_set));
192
+ k->form_a_cycle_rules[r].link_set=lsHandle;
193
+
194
+ /* read error message */
195
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
196
+ if (n_tokens > 1)
197
+ {
198
+ prt_error("Fatal Error: post_process: Invalid syntax (rule %i of %s)",r+1,label);
199
+ exit(1);
200
+ }
201
+ k->form_a_cycle_rules[r].msg=string_set_add(tokens[0],k->string_set);
202
+ }
203
+
204
+ /* sentinel entry */
205
+ k->form_a_cycle_rules[k->n_form_a_cycle_rules].msg = 0;
206
+ }
207
+
208
+ static void read_bounded_rules(pp_knowledge *k, const char *label)
209
+ {
210
+ const char **tokens;
211
+ int n_commas, n_tokens, r;
212
+ if (!pp_lexer_set_label(k->lt, label)) {
213
+ k->n_bounded_rules = 0;
214
+ if (verbosity>0) printf("PP warning: Not using any 'bounded' rules\n");
215
+ }
216
+ else {
217
+ n_commas = pp_lexer_count_commas_of_label(k->lt);
218
+ k->n_bounded_rules = (n_commas + 1)/2;
219
+ }
220
+ k->bounded_rules = (pp_rule*) xalloc ((1+k->n_bounded_rules)*sizeof(pp_rule));
221
+ for (r=0; r<k->n_bounded_rules; r++)
222
+ {
223
+ /* read domain */
224
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
225
+ if (n_tokens!=1)
226
+ {
227
+ prt_error("Fatal Error: post_process: Invalid syntax: rule %i of %s",r+1,label);
228
+ exit(1);
229
+ }
230
+ k->bounded_rules[r].domain = (int) tokens[0][0];
231
+
232
+ /* read error message */
233
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
234
+ if (n_tokens!=1)
235
+ {
236
+ prt_error("Fatal Error: post_process: Invalid syntax: rule %i of %s",r+1,label);
237
+ exit(1);
238
+ }
239
+ k->bounded_rules[r].msg = string_set_add(tokens[0], k->string_set);
240
+ }
241
+
242
+ /* sentinel entry */
243
+ k->bounded_rules[k->n_bounded_rules].msg = 0;
244
+ }
245
+
246
+ static void read_contains_rules(pp_knowledge *k, const char *label,
247
+ pp_rule **rules, int *nRules)
248
+ {
249
+ /* Reading the 'contains_one_rules' and reading the
250
+ 'contains_none_rules' into their respective arrays */
251
+ int n_commas, n_tokens, i, r;
252
+ const char *p;
253
+ const char **tokens;
254
+ if (!pp_lexer_set_label(k->lt, label)) {
255
+ *nRules = 0;
256
+ if (verbosity>0) printf("PP warning: Not using any %s rules\n", label);
257
+ }
258
+ else {
259
+ n_commas = pp_lexer_count_commas_of_label(k->lt);
260
+ *nRules = (n_commas + 1)/3;
261
+ }
262
+ *rules = (pp_rule*) xalloc ((1+*nRules)*sizeof(pp_rule));
263
+ for (r=0; r<*nRules; r++)
264
+ {
265
+ /* first read link */
266
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
267
+ if (n_tokens>1)
268
+ {
269
+ prt_error("Fatal Error: post_process: Invalid syntax in %s (rule %i)",label,r+1);
270
+ exit(1);
271
+ }
272
+ (*rules)[r].selector = string_set_add(tokens[0], k->string_set);
273
+
274
+ /* read link set */
275
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
276
+ (*rules)[r].link_set = pp_linkset_open(n_tokens);
277
+ (*rules)[r].link_set_size = n_tokens;
278
+ (*rules)[r].link_array = (const char **) xalloc((1+n_tokens)*sizeof(const char*));
279
+ for (i=0; i<n_tokens; i++)
280
+ {
281
+ p = string_set_add(tokens[i], k->string_set);
282
+ pp_linkset_add((*rules)[r].link_set, p);
283
+ (*rules)[r].link_array[i] = p;
284
+ }
285
+ (*rules)[r].link_array[i]=0; /* NULL-terminator */
286
+
287
+ /* read error message */
288
+ tokens = pp_lexer_get_next_group_of_tokens_of_label(k->lt, &n_tokens);
289
+ if (n_tokens>1)
290
+ {
291
+ prt_error("Fatal Error: post_process: Invalid syntax in %s (rule %i)",label,r+1);
292
+ exit(1);
293
+ }
294
+ (*rules)[r].msg = string_set_add(tokens[0], k->string_set);
295
+ }
296
+
297
+ /* sentinel entry */
298
+ (*rules)[*nRules].msg = 0;
299
+ }
300
+
301
+
302
+ static void read_rules(pp_knowledge *k)
303
+ {
304
+ read_form_a_cycle_rules(k, "FORM_A_CYCLE_RULES");
305
+ read_connected_rule(k, "CONNECTED_RULES");
306
+ read_bounded_rules(k, "BOUNDED_RULES");
307
+ read_contains_rules(k, "CONTAINS_ONE_RULES" ,
308
+ &(k->contains_one_rules), &(k->n_contains_one_rules));
309
+ read_contains_rules(k, "CONTAINS_NONE_RULES",
310
+ &(k->contains_none_rules), &(k->n_contains_none_rules));
311
+ }
312
+
313
+ static void free_rules(pp_knowledge *k)
314
+ {
315
+ int r;
316
+ int rs=sizeof(pp_rule);
317
+ pp_rule *rule;
318
+ for (r=0; k->contains_one_rules[r].msg!=0; r++) {
319
+ rule = &(k->contains_one_rules[r]); /* shorthand */
320
+ xfree((void*) rule->link_array, (1+rule->link_set_size)*sizeof(char*));
321
+ pp_linkset_close(rule->link_set);
322
+ }
323
+ for (r=0; k->contains_none_rules[r].msg!=0; r++) {
324
+ rule = &(k->contains_none_rules[r]); /* shorthand */
325
+ xfree((void *)rule->link_array, (1+rule->link_set_size)*sizeof(char*));
326
+ pp_linkset_close(rule->link_set);
327
+ }
328
+
329
+ for (r=0; r<k->n_form_a_cycle_rules; r++)
330
+ pp_linkset_close(k->form_a_cycle_rules[r].link_set);
331
+ xfree((void*)k->bounded_rules, rs*(1+k->n_bounded_rules));
332
+ xfree((void*)k->connected_rules, rs);
333
+ xfree((void*)k->form_a_cycle_rules, rs*(1+k->n_form_a_cycle_rules));
334
+ xfree((void*)k->contains_one_rules, rs*(1+k->n_contains_one_rules));
335
+ xfree((void*)k->contains_none_rules, rs*(1+k->n_contains_none_rules));
336
+ }
337
+
338
+ /********************* exported functions ***************************/
339
+
340
+ pp_knowledge *pp_knowledge_open(const char *path)
341
+ {
342
+ /* read knowledge from disk into pp_knowledge */
343
+ FILE *f = dictopen(path, "r");
344
+ pp_knowledge *k = (pp_knowledge *) xalloc (sizeof(pp_knowledge));
345
+ if (!f)
346
+ {
347
+ prt_error("Fatal Error: Couldn't find post-process knowledge file %s", path);
348
+ exit(1);
349
+ }
350
+ k->lt = pp_lexer_open(f);
351
+ fclose(f);
352
+ k->string_set = string_set_create();
353
+ k->path = string_set_add(path, k->string_set);
354
+ read_starting_link_table(k);
355
+ read_link_sets(k);
356
+ read_rules(k);
357
+ initialize_set_of_links_starting_bounded_domain(k);
358
+ return k;
359
+ }
360
+
361
+ void pp_knowledge_close(pp_knowledge *k)
362
+ {
363
+ /* clear the memory taken up by k */
364
+ xfree((void*)k->starting_link_lookup_table,
365
+ ((1+k->nStartingLinks)*sizeof(StartingLinkAndDomain)));
366
+ free_link_sets(k);
367
+ free_rules(k);
368
+ pp_linkset_close(k->set_of_links_starting_bounded_domain);
369
+ string_set_delete(k->string_set);
370
+ pp_lexer_close(k->lt);
371
+ xfree((void*)k, sizeof(pp_knowledge));
372
+ }
373
+
374
+
375
+
376
+
@@ -0,0 +1,14 @@
1
+ /*************************************************************************/
2
+ /* Copyright (c) 2004 */
3
+ /* Daniel Sleator, David Temperley, and John Lafferty */
4
+ /* All rights reserved */
5
+ /* */
6
+ /* Use of the link grammar parsing system is subject to the terms of the */
7
+ /* license set forth in the LICENSE file included with this software, */
8
+ /* and also available at http://www.link.cs.cmu.edu/link/license.html */
9
+ /* This license allows free redistribution and use in source and binary */
10
+ /* forms, with or without modification, subject to certain conditions. */
11
+ /* */
12
+ /*************************************************************************/
13
+ pp_knowledge *pp_knowledge_open(const char *path);
14
+ void pp_knowledge_close(pp_knowledge *knowledge);
@@ -0,0 +1,1920 @@
1
+ /*************************************************************************/
2
+ /* Copyright (c) 2004 */
3
+ /* Daniel Sleator, David Temperley, and John Lafferty */
4
+ /* All rights reserved */
5
+ /* */
6
+ /* Use of the link grammar parsing system is subject to the terms of the */
7
+ /* license set forth in the LICENSE file included with this software, */
8
+ /* and also available at http://www.link.cs.cmu.edu/link/license.html */
9
+ /* This license allows free redistribution and use in source and binary */
10
+ /* forms, with or without modification, subject to certain conditions. */
11
+ /* */
12
+ /*************************************************************************/
13
+
14
+ /* XXX the original flex source for this file is missing !! */
15
+
16
+ #include <string.h>
17
+ #include "error.h"
18
+
19
+ /* I edited this file to eliminate compiler warnings. I've documented here
20
+ all the changes. The .fl file from which this is derived is in
21
+ pp_lexer-flex-file. Here are all the warnings I got:
22
+
23
+ pp_lexer.c: In function `pp_lexer_lex':
24
+ pp_lexer.c:841: warning: implicit declaration of function `yywrap'
25
+ pp_lexer.c:689: warning: label `find_rule' defined but not used
26
+ pp_lexer.c: At top level:
27
+ pp_lexer.c:1590: warning: `yy_flex_realloc' defined but not used
28
+ pp_lexer.c:1099: warning: `yyunput' defined but not used
29
+ pp_lexer.c:1814: warning: `show_bindings' defined but not used
30
+
31
+
32
+ Here are the changes I made. All of them are labeled with "--DS" in
33
+ the code.
34
+
35
+ Got rid of #line directives.
36
+ Added the prototype of yywrap() right below this comment.
37
+ Commented out code and prototype declarations for the unused functions
38
+ */
39
+
40
+ int yywrap(void); /* --DS */
41
+
42
+ #define yy_create_buffer pp_lexer__create_buffer
43
+ #define yy_delete_buffer pp_lexer__delete_buffer
44
+ #define yy_scan_buffer pp_lexer__scan_buffer
45
+ #define yy_scan_string pp_lexer__scan_string
46
+ #define yy_scan_bytes pp_lexer__scan_bytes
47
+ #define yy_flex_debug pp_lexer__flex_debug
48
+ #define yy_init_buffer pp_lexer__init_buffer
49
+ #define yy_flush_buffer pp_lexer__flush_buffer
50
+ #define yy_load_buffer_state pp_lexer__load_buffer_state
51
+ #define yy_switch_to_buffer pp_lexer__switch_to_buffer
52
+ #define yyin pp_lexer_in
53
+ #define yyleng pp_lexer_leng
54
+ #define yylex pp_lexer_lex
55
+ #define yyout pp_lexer_out
56
+ #define yyrestart pp_lexer_restart
57
+ #define yytext pp_lexer_text
58
+ #define yylineno pp_lexer_lineno
59
+ #define yywrap pp_lexer_wrap
60
+
61
+ /* #line 21 "pp_lexer.c" --DS */
62
+ /* A lexical scanner generated by flex */
63
+
64
+ /* Scanner skeleton version:
65
+ * $Header$
66
+ */
67
+
68
+ #define FLEX_SCANNER
69
+ #define YY_FLEX_MAJOR_VERSION 2
70
+ #define YY_FLEX_MINOR_VERSION 5
71
+
72
+ #include <stdio.h>
73
+ #include <wchar.h>
74
+
75
+
76
+ /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
77
+ #ifdef c_plusplus
78
+ #ifndef __cplusplus
79
+ #define __cplusplus
80
+ #endif
81
+ #endif
82
+
83
+
84
+ #ifdef __cplusplus
85
+
86
+ #include <stdlib.h>
87
+ #include <unistd.h>
88
+
89
+ /* Use prototypes in function declarations. */
90
+ #define YY_USE_PROTOS
91
+
92
+ /* The "const" storage-class-modifier is valid. */
93
+ #define YY_USE_CONST
94
+
95
+ #else /* ! __cplusplus */
96
+
97
+ #if __STDC__
98
+
99
+ #define YY_USE_PROTOS
100
+ #define YY_USE_CONST
101
+
102
+ #endif /* __STDC__ */
103
+ #endif /* ! __cplusplus */
104
+
105
+ #ifdef __TURBOC__
106
+ #pragma warn -rch
107
+ #pragma warn -use
108
+ #include <io.h>
109
+ #include <stdlib.h>
110
+ #define YY_USE_CONST
111
+ #define YY_USE_PROTOS
112
+ #endif
113
+
114
+ #ifndef YY_USE_CONST
115
+ #ifndef const
116
+ #define const
117
+ #endif
118
+ #endif
119
+
120
+ #ifdef YY_USE_PROTOS
121
+ #define YY_PROTO(proto) proto
122
+ #else
123
+ #define YY_PROTO(proto) ()
124
+ #endif
125
+
126
+ /* Returned upon end-of-file. */
127
+ #define YY_NULL 0
128
+
129
+ /* Promotes a possibly negative, possibly signed char to an unsigned
130
+ * integer for use as an array index. If the signed char is negative,
131
+ * we want to instead treat it as an 8-bit unsigned char, hence the
132
+ * double cast.
133
+ */
134
+ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
135
+
136
+ /* Enter a start condition. This macro really ought to take a parameter,
137
+ * but we do it the disgusting crufty way forced on us by the ()-less
138
+ * definition of BEGIN.
139
+ */
140
+ #define BEGIN yy_start = 1 + 2 *
141
+
142
+ /* Translate the current start state into a value that can be later handed
143
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
144
+ * compatibility.
145
+ */
146
+ #define YY_START ((yy_start - 1) / 2)
147
+ #define YYSTATE YY_START
148
+
149
+ /* Action number for EOF rule of a given start state. */
150
+ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
151
+
152
+ /* Special action meaning "start processing a new file". */
153
+ #define YY_NEW_FILE yyrestart( yyin )
154
+
155
+ #define YY_END_OF_BUFFER_CHAR 0
156
+
157
+ /* Size of default input buffer. */
158
+ #define YY_BUF_SIZE 16384
159
+
160
+ typedef struct yy_buffer_state *YY_BUFFER_STATE;
161
+
162
+ extern int yyleng;
163
+ extern FILE *yyin, *yyout;
164
+
165
+ #define EOB_ACT_CONTINUE_SCAN 0
166
+ #define EOB_ACT_END_OF_FILE 1
167
+ #define EOB_ACT_LAST_MATCH 2
168
+
169
+ /* The funky do-while in the following #define is used to turn the definition
170
+ * int a single C statement (which needs a semi-colon terminator). This
171
+ * avoids problems with code like:
172
+ *
173
+ * if ( condition_holds )
174
+ * yyless( 5 );
175
+ * else
176
+ * do_something_else();
177
+ *
178
+ * Prior to using the do-while the compiler would get upset at the
179
+ * "else" because it interpreted the "if" statement as being all
180
+ * done when it reached the ';' after the yyless() call.
181
+ */
182
+
183
+ /* Return all but the first 'n' matched characters back to the input stream. */
184
+
185
+ #define yyless(n) \
186
+ do \
187
+ { \
188
+ /* Undo effects of setting up yytext. */ \
189
+ *yy_cp = yy_hold_char; \
190
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
191
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
192
+ } \
193
+ while ( 0 )
194
+
195
+ /* #define unput(c) yyunput( c, yytext_ptr ) --DS */
196
+
197
+ /* The following is because we cannot portably get our hands on size_t
198
+ * (without autoconf's help, which isn't available because we want
199
+ * flex-generated scanners to compile on their own).
200
+ */
201
+ typedef unsigned int yy_size_t;
202
+
203
+
204
+ struct yy_buffer_state
205
+ {
206
+ FILE *yy_input_file;
207
+
208
+ char *yy_ch_buf; /* input buffer */
209
+ char *yy_buf_pos; /* current position in input buffer */
210
+
211
+ /* Size of input buffer in bytes, not including room for EOB
212
+ * characters.
213
+ */
214
+ yy_size_t yy_buf_size;
215
+
216
+ /* Number of characters read into yy_ch_buf, not including EOB
217
+ * characters.
218
+ */
219
+ int yy_n_chars;
220
+
221
+ /* Whether we "own" the buffer - i.e., we know we created it,
222
+ * and can realloc() it to grow it, and should free() it to
223
+ * delete it.
224
+ */
225
+ int yy_is_our_buffer;
226
+
227
+ /* Whether this is an "interactive" input source; if so, and
228
+ * if we're using stdio for input, then we want to use getwc()
229
+ * instead of fread(), to make sure we stop fetching input after
230
+ * each newline.
231
+ */
232
+ int yy_is_interactive;
233
+
234
+ /* Whether we're considered to be at the beginning of a line.
235
+ * If so, '^' rules will be active on the next match, otherwise
236
+ * not.
237
+ */
238
+ int yy_at_bol;
239
+
240
+ /* Whether to try to fill the input buffer when we reach the
241
+ * end of it.
242
+ */
243
+ int yy_fill_buffer;
244
+
245
+ int yy_buffer_status;
246
+ #define YY_BUFFER_NEW 0
247
+ #define YY_BUFFER_NORMAL 1
248
+ /* When an EOF's been seen but there's still some text to process
249
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
250
+ * shouldn't try reading from the input source any more. We might
251
+ * still have a bunch of tokens to match, though, because of
252
+ * possible backing-up.
253
+ *
254
+ * When we actually see the EOF, we change the status to "new"
255
+ * (via yyrestart()), so that the user can continue scanning by
256
+ * just pointing yyin at a new input file.
257
+ */
258
+ #define YY_BUFFER_EOF_PENDING 2
259
+ };
260
+
261
+ static YY_BUFFER_STATE yy_current_buffer = 0;
262
+
263
+ /* We provide macros for accessing buffer states in case in the
264
+ * future we want to put the buffer states in a more general
265
+ * "scanner state".
266
+ */
267
+ #define YY_CURRENT_BUFFER yy_current_buffer
268
+
269
+
270
+ /* yy_hold_char holds the character lost when yytext is formed. */
271
+ static char yy_hold_char;
272
+
273
+ static int yy_n_chars; /* number of characters read into yy_ch_buf */
274
+
275
+
276
+ int yyleng;
277
+
278
+ /* Points to current character in buffer. */
279
+ static char *yy_c_buf_p = (char *) 0;
280
+ static int yy_init = 1; /* whether we need to initialize */
281
+ static int yy_start = 0; /* start state number */
282
+
283
+ /* Flag which is used to allow yywrap()'s to do buffer switches
284
+ * instead of setting up a fresh yyin. A bit of a hack ...
285
+ */
286
+ static int yy_did_buffer_switch_on_eof;
287
+
288
+ void yyrestart YY_PROTO(( FILE *input_file ));
289
+
290
+ void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
291
+ void yy_load_buffer_state YY_PROTO(( void ));
292
+ YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
293
+ void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
294
+ void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
295
+ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
296
+ #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
297
+
298
+ YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
299
+ YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str ));
300
+ YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len ));
301
+
302
+ static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
303
+ /* static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); --DS */
304
+ static void yy_flex_free YY_PROTO(( void * ));
305
+
306
+ #define yy_new_buffer yy_create_buffer
307
+
308
+ #define yy_set_interactive(is_interactive) \
309
+ { \
310
+ if ( ! yy_current_buffer ) \
311
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
312
+ yy_current_buffer->yy_is_interactive = is_interactive; \
313
+ }
314
+
315
+ #define yy_set_bol(at_bol) \
316
+ { \
317
+ if ( ! yy_current_buffer ) \
318
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
319
+ yy_current_buffer->yy_at_bol = at_bol; \
320
+ }
321
+
322
+ #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
323
+
324
+
325
+ #define YY_USES_REJECT
326
+ typedef unsigned char YY_CHAR;
327
+ #ifdef VMS
328
+ #ifndef __VMS_POSIX
329
+ FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
330
+ #else
331
+ FILE *yyin = stdin, *yyout = stdout;
332
+ #endif
333
+ #else
334
+ FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
335
+ #endif
336
+ typedef int yy_state_type;
337
+ extern int yylineno;
338
+ int yylineno = 1;
339
+ extern char *yytext;
340
+ #define yytext_ptr yytext
341
+
342
+ #ifndef YY_SKIP_YYWRAP
343
+ #ifdef __cplusplus
344
+ extern "C" int yywrap YY_PROTO(( void ));
345
+ #else
346
+ extern int yywrap YY_PROTO(( void ));
347
+ #endif
348
+ #endif
349
+
350
+ #if 0 /* --DS */
351
+ #ifndef YY_NO_UNPUT
352
+ static void yyunput YY_PROTO(( int c, char *buf_ptr ));
353
+ #endif
354
+ #endif /* --DS */
355
+
356
+ #ifndef yytext_ptr
357
+ static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
358
+ #endif
359
+
360
+ #ifdef THIS_FUNCTION_IS_NO_LONGER_USED
361
+ #ifndef YY_NO_INPUT
362
+ #ifdef __cplusplus
363
+ static int yyinput YY_PROTO(( void ));
364
+ #else
365
+ static int input YY_PROTO(( void ));
366
+ #endif
367
+ #endif
368
+ #endif /* THIS_FUNCTION_IS_NO_LONGER_USED */
369
+
370
+ static yy_state_type yy_get_previous_state YY_PROTO(( void ));
371
+ static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
372
+ static int yy_get_next_buffer YY_PROTO(( mbstate_t * ));
373
+ static void yy_fatal_error YY_PROTO(( const char msg[] ));
374
+
375
+ /* Done after the current pattern has been matched and before the
376
+ * corresponding action - sets up yytext.
377
+ */
378
+ #define YY_DO_BEFORE_ACTION \
379
+ yytext_ptr = yy_bp; \
380
+ yyleng = (int) (yy_cp - yy_bp); \
381
+ yy_hold_char = *yy_cp; \
382
+ *yy_cp = '\0'; \
383
+ yy_c_buf_p = yy_cp;
384
+
385
+ #define YY_NUM_RULES 8
386
+ #define YY_END_OF_BUFFER 9
387
+ static const short int yy_acclist[39] =
388
+ { 0,
389
+ 2, 2, 2, 2, 9, 5, 7, 8, 2, 7,
390
+ 8, 2, 8, 7, 8, 7, 8, 5, 7, 8,
391
+ 2, 7, 8, 5, 7, 8, 7, 8, 5, 3,
392
+ 2, 4, 5, 2, 5, 1, 3, 6
393
+ } ;
394
+
395
+ static const short int yy_accept[29] =
396
+ { 0,
397
+ 1, 2, 3, 4, 5, 6, 9, 12, 14, 16,
398
+ 18, 21, 24, 27, 29, 30, 31, 32, 32, 34,
399
+ 35, 35, 36, 36, 37, 38, 39, 39
400
+ } ;
401
+
402
+ static const int yy_ec[256] =
403
+ { 0,
404
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
405
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407
+ 1, 4, 1, 5, 1, 1, 1, 1, 1, 1,
408
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409
+ 1, 1, 1, 1, 1, 1, 1, 6, 7, 1,
410
+ 1, 1, 1, 8, 1, 1, 1, 1, 1, 1,
411
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414
+
415
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425
+
426
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431
+ 1, 1, 1, 1, 1
432
+ } ;
433
+
434
+ static const int yy_meta[9] =
435
+ { 0,
436
+ 1, 2, 2, 3, 4, 5, 1, 1
437
+ } ;
438
+
439
+ static const short int yy_base[32] =
440
+ { 0,
441
+ 0, 7, 14, 21, 18, 11, 0, 0, 0, 66,
442
+ 10, 27, 34, 42, 7, 66, 0, 7, 4, 0,
443
+ 0, 0, 0, 66, 0, 66, 66, 50, 54, 57,
444
+ 60
445
+ } ;
446
+
447
+ static const short int yy_def[32] =
448
+ { 0,
449
+ 27, 1, 1, 3, 27, 28, 29, 29, 30, 27,
450
+ 31, 27, 27, 13, 28, 27, 29, 30, 31, 12,
451
+ 14, 13, 14, 27, 14, 27, 0, 27, 27, 27,
452
+ 27
453
+ } ;
454
+
455
+ static const short int yy_nxt[75] =
456
+ { 0,
457
+ 6, 7, 8, 7, 9, 10, 6, 11, 12, 16,
458
+ 12, 26, 16, 13, 10, 16, 16, 27, 10, 27,
459
+ 10, 10, 12, 27, 12, 27, 27, 14, 20, 17,
460
+ 20, 27, 27, 21, 22, 23, 24, 23, 23, 25,
461
+ 22, 22, 23, 27, 27, 27, 27, 23, 23, 23,
462
+ 15, 27, 27, 27, 15, 17, 17, 18, 27, 18,
463
+ 19, 27, 27, 27, 19, 5, 27, 27, 27, 27,
464
+ 27, 27, 27, 27
465
+ } ;
466
+
467
+ static const short int yy_chk[75] =
468
+ { 0,
469
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 19,
470
+ 2, 18, 15, 2, 3, 11, 6, 5, 3, 0,
471
+ 3, 3, 4, 0, 4, 0, 0, 4, 12, 12,
472
+ 12, 0, 0, 12, 13, 13, 13, 13, 13, 13,
473
+ 13, 13, 14, 0, 0, 0, 0, 14, 14, 14,
474
+ 28, 0, 0, 0, 28, 29, 29, 30, 0, 30,
475
+ 31, 0, 0, 0, 31, 27, 27, 27, 27, 27,
476
+ 27, 27, 27, 27
477
+ } ;
478
+
479
+ static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
480
+ static char *yy_full_match;
481
+ static int yy_lp;
482
+ #define REJECT \
483
+ { \
484
+ *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
485
+ yy_cp = yy_full_match; /* restore poss. backed-over text */ \
486
+ ++yy_lp; \
487
+ goto find_rule; \
488
+ }
489
+ #define yymore() yymore_used_but_not_detected
490
+ #define YY_MORE_ADJ 0
491
+ char *yytext;
492
+ /* #line 1 "pp_lexer.fl" --DS */
493
+ #define INITIAL 0
494
+ /* #line 2 "pp_lexer.fl" --DS */
495
+ /**************************************************************************
496
+ Lex specification for post-process knowledge file
497
+ 6/96 ALB
498
+ Updated 8/97 to allow multiple instances
499
+ Compile with either
500
+ 1) flex pp_lexer.fl (on systems which support %option prefix) OR
501
+ 2) flex pp_lexer.fl
502
+ mv lex.yy.c pp_lexer.tmp.c
503
+ cat pp_lexer.tmp.c | sed "s/yy/pp_lexer_/g" > pp_lexer.c
504
+ rm -f pp_lexer.tmp.c
505
+ (on systems which do not)
506
+
507
+ In the case of (1), uncomment the three %option lines below.
508
+ **************************************************************************/
509
+
510
+ #include <stdarg.h>
511
+ #include "api.h"
512
+
513
+ #undef yywrap
514
+
515
+ /* forward references for non-exported functions (and static variable) */
516
+ static void check_string(const char *str);
517
+ static void setup(PPLexTable *lt);
518
+ static void set_label(PPLexTable *lt, const char *label);
519
+ static void add_string_to_label(PPLexTable *lt, const char *str);
520
+ static void add_set_of_strings_to_label(PPLexTable *lt,const char *label_of_set);
521
+ /* static void show_bindings(PPLexTable *lt); --DS */
522
+ static int get_index_of_label(PPLexTable *lt, const char *label);
523
+ static PPLexTable *clt=NULL; /* ptr to lex table we're currently filling in */
524
+ /* see above */
525
+ #define INCLUDE 1
526
+
527
+ /* #line 490 "pp_lexer.c" --DS */
528
+
529
+ /* Macros after this point can all be overridden by user definitions in
530
+ * section 1.
531
+ */
532
+
533
+ #if YY_STACK_USED
534
+ static int yy_start_stack_ptr = 0;
535
+ static int yy_start_stack_depth = 0;
536
+ static int *yy_start_stack = 0;
537
+ #ifndef YY_NO_PUSH_STATE
538
+ static void yy_push_state YY_PROTO(( int new_state ));
539
+ #endif
540
+ #ifndef YY_NO_POP_STATE
541
+ static void yy_pop_state YY_PROTO(( void ));
542
+ #endif
543
+ #ifndef YY_NO_TOP_STATE
544
+ static int yy_top_state YY_PROTO(( void ));
545
+ #endif
546
+
547
+ #else
548
+ #define YY_NO_PUSH_STATE 1
549
+ #define YY_NO_POP_STATE 1
550
+ #define YY_NO_TOP_STATE 1
551
+ #endif
552
+
553
+ #ifdef YY_MALLOC_DECL
554
+ YY_MALLOC_DECL
555
+ #else
556
+ #if __STDC__
557
+ #ifndef __cplusplus
558
+ #include <stdlib.h>
559
+ #endif
560
+ #else
561
+ /* Just try to get by without declaring the routines. This will fail
562
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
563
+ * or sizeof(void*) != sizeof(int).
564
+ */
565
+ #endif
566
+ #endif
567
+
568
+ /* Amount of stuff to slurp up with each read. */
569
+ #ifndef YY_READ_BUF_SIZE
570
+ #define YY_READ_BUF_SIZE 8192
571
+ #endif
572
+
573
+ /* Copy whatever the last rule matched to the standard output. */
574
+
575
+ #ifndef ECHO
576
+ /* This used to be an fputs(), but since the string might contain NUL's,
577
+ * we now use fwrite().
578
+ */
579
+ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
580
+ #endif
581
+
582
+ /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
583
+ * is returned in "result".
584
+ */
585
+ #ifndef YY_INPUT
586
+ #define YY_INPUT(buf,result,max_size,pmbss) \
587
+ if ( yy_current_buffer->yy_is_interactive ) \
588
+ { \
589
+ wint_t c = '*'; \
590
+ int n; \
591
+ for ( n = 0; n < max_size && \
592
+ (c = fgetwc( yyin )) != WEOF && c != '\n'; ) \
593
+ n += wcrtomb(&buf[n], c, pmbss); \
594
+ if ( c == '\n' ) \
595
+ buf[n++] = '\n'; \
596
+ if ( c == WEOF && ferror( yyin ) ) \
597
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
598
+ result = n; \
599
+ } \
600
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
601
+ && ferror( yyin ) ) \
602
+ YY_FATAL_ERROR( "input in flex scanner failed" );
603
+ #endif
604
+
605
+ /* No semi-colon after return; correct usage is to write "yyterminate();" -
606
+ * we don't want an extra ';' after the "return" because that will cause
607
+ * some compilers to complain about unreachable statements.
608
+ */
609
+ #ifndef yyterminate
610
+ #define yyterminate() return YY_NULL
611
+ #endif
612
+
613
+ /* Number of entries by which start-condition stack grows. */
614
+ #ifndef YY_START_STACK_INCR
615
+ #define YY_START_STACK_INCR 25
616
+ #endif
617
+
618
+ /* Report a fatal error. */
619
+ #ifndef YY_FATAL_ERROR
620
+ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
621
+ #endif
622
+
623
+ /* Default declaration of generated scanner - a define so the user can
624
+ * easily add parameters.
625
+ */
626
+ #ifndef YY_DECL
627
+ #define YY_DECL int yylex YY_PROTO(( void ))
628
+ #endif
629
+
630
+ /* Code executed at the beginning of each rule, after yytext and yyleng
631
+ * have been set up.
632
+ */
633
+ #ifndef YY_USER_ACTION
634
+ #define YY_USER_ACTION
635
+ #endif
636
+
637
+ /* Code executed at the end of each rule. */
638
+ #ifndef YY_BREAK
639
+ #define YY_BREAK break;
640
+ #endif
641
+
642
+ #define YY_RULE_SETUP \
643
+ if ( yyleng > 0 ) \
644
+ yy_current_buffer->yy_at_bol = \
645
+ (yytext[yyleng - 1] == '\n'); \
646
+ YY_USER_ACTION
647
+
648
+ YY_DECL;
649
+ YY_DECL
650
+ {
651
+ yy_state_type yy_current_state;
652
+ char *yy_cp, *yy_bp;
653
+ int yy_act;
654
+
655
+ /* Reset multi-byte shift state */
656
+ mbstate_t mbss;
657
+ memset(&mbss, 0, sizeof(mbss));
658
+
659
+ /* #line 56 "pp_lexer.fl" --DS */
660
+
661
+
662
+ /* #line 619 "pp_lexer.c" --DS */
663
+
664
+ if ( yy_init )
665
+ {
666
+ yy_init = 0;
667
+
668
+ #ifdef YY_USER_INIT
669
+ YY_USER_INIT;
670
+ #endif
671
+
672
+ if ( ! yy_start )
673
+ yy_start = 1; /* first start state */
674
+
675
+ if ( ! yyin )
676
+ yyin = stdin;
677
+
678
+ if ( ! yyout )
679
+ yyout = stdout;
680
+
681
+ if ( ! yy_current_buffer )
682
+ yy_current_buffer =
683
+ yy_create_buffer( yyin, YY_BUF_SIZE );
684
+
685
+ yy_load_buffer_state();
686
+ }
687
+
688
+ while ( 1 ) /* loops until end-of-file is reached */
689
+ {
690
+ yy_cp = yy_c_buf_p;
691
+
692
+ /* Support of yytext. */
693
+ *yy_cp = yy_hold_char;
694
+
695
+ /* yy_bp points to the position in yy_ch_buf of the start of
696
+ * the current run.
697
+ */
698
+ yy_bp = yy_cp;
699
+
700
+ yy_current_state = yy_start;
701
+ yy_current_state += YY_AT_BOL();
702
+ yy_state_ptr = yy_state_buf;
703
+ *yy_state_ptr++ = yy_current_state;
704
+ yy_match:
705
+ do
706
+ {
707
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
708
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
709
+ {
710
+ yy_current_state = (int) yy_def[yy_current_state];
711
+ if ( yy_current_state >= 28 )
712
+ yy_c = yy_meta[(unsigned int) yy_c];
713
+ }
714
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
715
+ *yy_state_ptr++ = yy_current_state;
716
+ ++yy_cp;
717
+ }
718
+ while ( yy_base[yy_current_state] != 66 );
719
+
720
+ yy_find_action:
721
+ yy_current_state = *--yy_state_ptr;
722
+ yy_lp = yy_accept[yy_current_state];
723
+ /* find_rule: --DS */ /* we branch to this label when backing up */
724
+ for ( ; ; ) /* until we find what rule we matched */
725
+ {
726
+ if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
727
+ {
728
+ yy_act = yy_acclist[yy_lp];
729
+ {
730
+ yy_full_match = yy_cp;
731
+ break;
732
+ }
733
+ }
734
+ --yy_cp;
735
+ yy_current_state = *--yy_state_ptr;
736
+ yy_lp = yy_accept[yy_current_state];
737
+ }
738
+
739
+ YY_DO_BEFORE_ACTION;
740
+
741
+ if ( yy_act != YY_END_OF_BUFFER )
742
+ {
743
+ int yyl;
744
+ for ( yyl = 0; yyl < yyleng; ++yyl )
745
+ if ( yytext[yyl] == '\n' )
746
+ ++yylineno;
747
+ }
748
+
749
+ do_action: /* This label is used only to access EOF actions. */
750
+
751
+
752
+ switch ( yy_act )
753
+ { /* beginning of action switch */
754
+ case 1:
755
+ *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
756
+ yy_c_buf_p = yy_cp -= 1;
757
+ YY_DO_BEFORE_ACTION; /* set up yytext again */
758
+ YY_RULE_SETUP
759
+ /* #line 58 "pp_lexer.fl" --DS */
760
+ ;
761
+ YY_BREAK
762
+ case 2:
763
+ YY_RULE_SETUP
764
+ /* #line 59 "pp_lexer.fl" --DS */
765
+ ;
766
+ YY_BREAK
767
+ case 3:
768
+ YY_RULE_SETUP
769
+ /* #line 61 "pp_lexer.fl" --DS */
770
+ { set_label(clt, yytext); }
771
+ YY_BREAK
772
+ case 4:
773
+ YY_RULE_SETUP
774
+ /* #line 62 "pp_lexer.fl" --DS */
775
+ { add_set_of_strings_to_label(clt, &(yytext[1])); }
776
+ YY_BREAK
777
+ case 5:
778
+ YY_RULE_SETUP
779
+ /* #line 63 "pp_lexer.fl" --DS */
780
+ { add_string_to_label(clt, yytext); }
781
+ YY_BREAK
782
+ case 6:
783
+ YY_RULE_SETUP
784
+ /* #line 64 "pp_lexer.fl" --DS */
785
+ { add_string_to_label(clt, yytext); }
786
+ YY_BREAK
787
+ case 7:
788
+ YY_RULE_SETUP
789
+ /* #line 66 "pp_lexer.fl" --DS */
790
+ { prt_error("Fatal Error: pp_lexer: unable to parse knowledge file (line %i).\n",yylineno); exit(1); }
791
+ YY_BREAK
792
+ case 8:
793
+ YY_RULE_SETUP
794
+ /* #line 68 "pp_lexer.fl" --DS */
795
+ ECHO;
796
+ YY_BREAK
797
+ /* #line 754 "pp_lexer.c" --DS */
798
+ case YY_STATE_EOF(INITIAL):
799
+ case YY_STATE_EOF(INCLUDE):
800
+ yyterminate();
801
+
802
+ case YY_END_OF_BUFFER:
803
+ {
804
+ /* Amount of text matched not including the EOB char. */
805
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
806
+
807
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
808
+ *yy_cp = yy_hold_char;
809
+
810
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
811
+ {
812
+ /* We're scanning a new file or input source. It's
813
+ * possible that this happened because the user
814
+ * just pointed yyin at a new source and called
815
+ * yylex(). If so, then we have to assure
816
+ * consistency between yy_current_buffer and our
817
+ * globals. Here is the right place to do so, because
818
+ * this is the first action (other than possibly a
819
+ * back-up) that will match for the new input source.
820
+ */
821
+ yy_n_chars = yy_current_buffer->yy_n_chars;
822
+ yy_current_buffer->yy_input_file = yyin;
823
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
824
+ }
825
+
826
+ /* Note that here we test for yy_c_buf_p "<=" to the position
827
+ * of the first EOB in the buffer, since yy_c_buf_p will
828
+ * already have been incremented past the NUL character
829
+ * (since all states make transitions on EOB to the
830
+ * end-of-buffer state). Contrast this with the test
831
+ * in input().
832
+ */
833
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
834
+ { /* This was really a NUL. */
835
+ yy_state_type yy_next_state;
836
+
837
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
838
+
839
+ yy_current_state = yy_get_previous_state();
840
+
841
+ /* Okay, we're now positioned to make the NUL
842
+ * transition. We couldn't have
843
+ * yy_get_previous_state() go ahead and do it
844
+ * for us because it doesn't know how to deal
845
+ * with the possibility of jamming (and we don't
846
+ * want to build jamming into it because then it
847
+ * will run more slowly).
848
+ */
849
+
850
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
851
+
852
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
853
+
854
+ if ( yy_next_state )
855
+ {
856
+ /* Consume the NUL. */
857
+ yy_cp = ++yy_c_buf_p;
858
+ yy_current_state = yy_next_state;
859
+ goto yy_match;
860
+ }
861
+
862
+ else
863
+ {
864
+ yy_cp = yy_c_buf_p;
865
+ goto yy_find_action;
866
+ }
867
+ }
868
+
869
+ else switch ( yy_get_next_buffer(&mbss) )
870
+ {
871
+ case EOB_ACT_END_OF_FILE:
872
+ {
873
+ yy_did_buffer_switch_on_eof = 0;
874
+
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
+
888
+ yy_act = YY_STATE_EOF(YY_START);
889
+ goto do_action;
890
+ }
891
+
892
+ else
893
+ {
894
+ if ( ! yy_did_buffer_switch_on_eof )
895
+ YY_NEW_FILE;
896
+ }
897
+ break;
898
+ }
899
+
900
+ case EOB_ACT_CONTINUE_SCAN:
901
+ yy_c_buf_p =
902
+ yytext_ptr + yy_amount_of_matched_text;
903
+
904
+ yy_current_state = yy_get_previous_state();
905
+
906
+ yy_cp = yy_c_buf_p;
907
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
908
+ goto yy_match;
909
+
910
+ case EOB_ACT_LAST_MATCH:
911
+ yy_c_buf_p =
912
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
913
+
914
+ yy_current_state = yy_get_previous_state();
915
+
916
+ yy_cp = yy_c_buf_p;
917
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
918
+ goto yy_find_action;
919
+ }
920
+ break;
921
+ }
922
+
923
+ default:
924
+ YY_FATAL_ERROR(
925
+ "fatal flex scanner internal error--no action found" );
926
+ } /* end of action switch */
927
+ } /* end of scanning one token */
928
+ } /* end of yylex */
929
+
930
+
931
+ /* yy_get_next_buffer - try to read in a new buffer
932
+ *
933
+ * Returns a code representing an action:
934
+ * EOB_ACT_LAST_MATCH -
935
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
936
+ * EOB_ACT_END_OF_FILE - end of file
937
+ */
938
+
939
+ static int yy_get_next_buffer(mbstate_t *pmbss)
940
+ {
941
+ char *dest = yy_current_buffer->yy_ch_buf;
942
+ char *source = yytext_ptr;
943
+ int number_to_move, i;
944
+ int ret_val;
945
+
946
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
947
+ YY_FATAL_ERROR(
948
+ "fatal flex scanner internal error--end of buffer missed" );
949
+
950
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
951
+ { /* Don't try to fill the buffer, so this is an EOF. */
952
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
953
+ {
954
+ /* We matched a singled characater, the EOB, so
955
+ * treat this as a final EOF.
956
+ */
957
+ return EOB_ACT_END_OF_FILE;
958
+ }
959
+
960
+ else
961
+ {
962
+ /* We matched some text prior to the EOB, first
963
+ * process it.
964
+ */
965
+ return EOB_ACT_LAST_MATCH;
966
+ }
967
+ }
968
+
969
+ /* Try to read more data. */
970
+
971
+ /* First move last chars to start of buffer. */
972
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
973
+
974
+ for ( i = 0; i < number_to_move; ++i )
975
+ *(dest++) = *(source++);
976
+
977
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
978
+ /* don't do the read, it's not guaranteed to return an EOF,
979
+ * just force an EOF
980
+ */
981
+ yy_n_chars = 0;
982
+
983
+ else
984
+ {
985
+ int num_to_read =
986
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
987
+
988
+ while ( num_to_read <= 0 )
989
+ { /* Not enough room in the buffer - grow it. */
990
+ #ifdef YY_USES_REJECT
991
+ YY_FATAL_ERROR(
992
+ "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
993
+ #else
994
+
995
+ /* just a shorter name for the current buffer */
996
+ YY_BUFFER_STATE b = yy_current_buffer;
997
+
998
+ int yy_c_buf_p_offset =
999
+ (int) (yy_c_buf_p - b->yy_ch_buf);
1000
+
1001
+ if ( b->yy_is_our_buffer )
1002
+ {
1003
+ int new_size = b->yy_buf_size * 2;
1004
+
1005
+ if ( new_size <= 0 )
1006
+ b->yy_buf_size += b->yy_buf_size / 8;
1007
+ else
1008
+ b->yy_buf_size *= 2;
1009
+
1010
+ b->yy_ch_buf = (char *)
1011
+ /* Include room in for 2 EOB chars. */
1012
+ yy_flex_realloc( (void *) b->yy_ch_buf,
1013
+ b->yy_buf_size + 2 );
1014
+ }
1015
+ else
1016
+ /* Can't grow it, we don't own it. */
1017
+ b->yy_ch_buf = 0;
1018
+
1019
+ if ( ! b->yy_ch_buf )
1020
+ YY_FATAL_ERROR(
1021
+ "fatal error - scanner input buffer overflow" );
1022
+
1023
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1024
+
1025
+ num_to_read = yy_current_buffer->yy_buf_size -
1026
+ number_to_move - 1;
1027
+ #endif
1028
+ }
1029
+
1030
+ if ( num_to_read > YY_READ_BUF_SIZE )
1031
+ num_to_read = YY_READ_BUF_SIZE;
1032
+
1033
+ /* Read in more data. */
1034
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1035
+ yy_n_chars, num_to_read, pmbss );
1036
+ }
1037
+
1038
+ if ( yy_n_chars == 0 )
1039
+ {
1040
+ if ( number_to_move == YY_MORE_ADJ )
1041
+ {
1042
+ ret_val = EOB_ACT_END_OF_FILE;
1043
+ yyrestart( yyin );
1044
+ }
1045
+
1046
+ else
1047
+ {
1048
+ ret_val = EOB_ACT_LAST_MATCH;
1049
+ yy_current_buffer->yy_buffer_status =
1050
+ YY_BUFFER_EOF_PENDING;
1051
+ }
1052
+ }
1053
+
1054
+ else
1055
+ ret_val = EOB_ACT_CONTINUE_SCAN;
1056
+
1057
+ yy_n_chars += number_to_move;
1058
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1059
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1060
+
1061
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1062
+
1063
+ return ret_val;
1064
+ }
1065
+
1066
+
1067
+ /* yy_get_previous_state - get the state just before the EOB char was reached */
1068
+
1069
+ static yy_state_type yy_get_previous_state(void)
1070
+ {
1071
+ register yy_state_type yy_current_state;
1072
+ register char *yy_cp;
1073
+
1074
+ yy_current_state = yy_start;
1075
+ yy_current_state += YY_AT_BOL();
1076
+ yy_state_ptr = yy_state_buf;
1077
+ *yy_state_ptr++ = yy_current_state;
1078
+
1079
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1080
+ {
1081
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1082
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1083
+ {
1084
+ yy_current_state = (int) yy_def[yy_current_state];
1085
+ if ( yy_current_state >= 28 )
1086
+ yy_c = yy_meta[(unsigned int) yy_c];
1087
+ }
1088
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1089
+ *yy_state_ptr++ = yy_current_state;
1090
+ }
1091
+
1092
+ return yy_current_state;
1093
+ }
1094
+
1095
+
1096
+ /* yy_try_NUL_trans - try to make a transition on the NUL character
1097
+ *
1098
+ * synopsis
1099
+ * next_state = yy_try_NUL_trans( current_state );
1100
+ */
1101
+
1102
+ #ifdef YY_USE_PROTOS
1103
+ static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1104
+ #else
1105
+ static yy_state_type yy_try_NUL_trans( yy_current_state )
1106
+ yy_state_type yy_current_state;
1107
+ #endif
1108
+ {
1109
+ register int yy_is_jam;
1110
+
1111
+ register YY_CHAR yy_c = 1;
1112
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1113
+ {
1114
+ yy_current_state = (int) yy_def[yy_current_state];
1115
+ if ( yy_current_state >= 28 )
1116
+ yy_c = yy_meta[(unsigned int) yy_c];
1117
+ }
1118
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1119
+ *yy_state_ptr++ = yy_current_state;
1120
+ yy_is_jam = (yy_current_state == 27);
1121
+
1122
+ return yy_is_jam ? 0 : yy_current_state;
1123
+ }
1124
+
1125
+
1126
+ #if 0 /* --DS */
1127
+ #ifdef YY_USE_PROTOS
1128
+ static void yyunput( int c, register char *yy_bp )
1129
+ #else
1130
+ static void yyunput( c, yy_bp )
1131
+ int c;
1132
+ register char *yy_bp;
1133
+ #endif
1134
+ {
1135
+ register char *yy_cp = yy_c_buf_p;
1136
+
1137
+ /* undo effects of setting up yytext */
1138
+ *yy_cp = yy_hold_char;
1139
+
1140
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1141
+ { /* need to shift things up to make room */
1142
+ /* +2 for EOB chars. */
1143
+ register int number_to_move = yy_n_chars + 2;
1144
+ register char *dest = &yy_current_buffer->yy_ch_buf[
1145
+ yy_current_buffer->yy_buf_size + 2];
1146
+ register char *source =
1147
+ &yy_current_buffer->yy_ch_buf[number_to_move];
1148
+
1149
+ while ( source > yy_current_buffer->yy_ch_buf )
1150
+ *--dest = *--source;
1151
+
1152
+ yy_cp += (int) (dest - source);
1153
+ yy_bp += (int) (dest - source);
1154
+ yy_n_chars = yy_current_buffer->yy_buf_size;
1155
+
1156
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1157
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
1158
+ }
1159
+
1160
+ *--yy_cp = (char) c;
1161
+
1162
+ if ( c == '\n' )
1163
+ --yylineno;
1164
+
1165
+ yytext_ptr = yy_bp;
1166
+ yy_hold_char = *yy_cp;
1167
+ yy_c_buf_p = yy_cp;
1168
+ }
1169
+ #endif /* --DS */
1170
+
1171
+ #ifdef THIS_FUNCTION_IS_NOT_USED_ANYMORE
1172
+ #ifdef __cplusplus
1173
+ static int yyinput(void)
1174
+ #else
1175
+ static int input(void)
1176
+ #endif
1177
+ {
1178
+ int c;
1179
+
1180
+ *yy_c_buf_p = yy_hold_char;
1181
+
1182
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1183
+ {
1184
+ /* yy_c_buf_p now points to the character we want to return.
1185
+ * If this occurs *before* the EOB characters, then it's a
1186
+ * valid NUL; if not, then we've hit the end of the buffer.
1187
+ */
1188
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1189
+ /* This was really a NUL. */
1190
+ *yy_c_buf_p = '\0';
1191
+
1192
+ else
1193
+ { /* need more input */
1194
+ yytext_ptr = yy_c_buf_p;
1195
+ ++yy_c_buf_p;
1196
+
1197
+ switch ( yy_get_next_buffer() )
1198
+ {
1199
+ case EOB_ACT_END_OF_FILE:
1200
+ {
1201
+ if ( yywrap() )
1202
+ {
1203
+ yy_c_buf_p =
1204
+ yytext_ptr + YY_MORE_ADJ;
1205
+ return EOF;
1206
+ }
1207
+
1208
+ if ( ! yy_did_buffer_switch_on_eof )
1209
+ YY_NEW_FILE;
1210
+ #ifdef __cplusplus
1211
+ return yyinput();
1212
+ #else
1213
+ return input();
1214
+ #endif
1215
+ }
1216
+
1217
+ case EOB_ACT_CONTINUE_SCAN:
1218
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1219
+ break;
1220
+
1221
+ case EOB_ACT_LAST_MATCH:
1222
+ #ifdef __cplusplus
1223
+ YY_FATAL_ERROR(
1224
+ "unexpected last match in yyinput()" );
1225
+ #else
1226
+ YY_FATAL_ERROR(
1227
+ "unexpected last match in input()" );
1228
+ #endif
1229
+ }
1230
+ }
1231
+ }
1232
+
1233
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1234
+ *yy_c_buf_p = '\0'; /* preserve yytext */
1235
+ yy_hold_char = *++yy_c_buf_p;
1236
+
1237
+ yy_current_buffer->yy_at_bol = (c == '\n');
1238
+ if ( yy_current_buffer->yy_at_bol )
1239
+ ++yylineno;
1240
+
1241
+ return c;
1242
+ }
1243
+ #endif /* THIS_FUNCTION_IS_NOT_USED_ANYMORE */
1244
+
1245
+
1246
+ #ifdef YY_USE_PROTOS
1247
+ void yyrestart( FILE *input_file )
1248
+ #else
1249
+ void yyrestart( input_file )
1250
+ FILE *input_file;
1251
+ #endif
1252
+ {
1253
+ if ( ! yy_current_buffer )
1254
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1255
+
1256
+ yy_init_buffer( yy_current_buffer, input_file );
1257
+ yy_load_buffer_state();
1258
+ }
1259
+
1260
+
1261
+ #ifdef YY_USE_PROTOS
1262
+ void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1263
+ #else
1264
+ void yy_switch_to_buffer( new_buffer )
1265
+ YY_BUFFER_STATE new_buffer;
1266
+ #endif
1267
+ {
1268
+ if ( yy_current_buffer == new_buffer )
1269
+ return;
1270
+
1271
+ if ( yy_current_buffer )
1272
+ {
1273
+ /* Flush out information for old buffer. */
1274
+ *yy_c_buf_p = yy_hold_char;
1275
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1276
+ yy_current_buffer->yy_n_chars = yy_n_chars;
1277
+ }
1278
+
1279
+ yy_current_buffer = new_buffer;
1280
+ yy_load_buffer_state();
1281
+
1282
+ /* We don't actually know whether we did this switch during
1283
+ * EOF (yywrap()) processing, but the only time this flag
1284
+ * is looked at is after yywrap() is called, so it's safe
1285
+ * to go ahead and always set it.
1286
+ */
1287
+ yy_did_buffer_switch_on_eof = 1;
1288
+ }
1289
+
1290
+
1291
+ #ifdef YY_USE_PROTOS
1292
+ void yy_load_buffer_state( void )
1293
+ #else
1294
+ void yy_load_buffer_state()
1295
+ #endif
1296
+ {
1297
+ yy_n_chars = yy_current_buffer->yy_n_chars;
1298
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1299
+ yyin = yy_current_buffer->yy_input_file;
1300
+ yy_hold_char = *yy_c_buf_p;
1301
+ }
1302
+
1303
+
1304
+ #ifdef YY_USE_PROTOS
1305
+ YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1306
+ #else
1307
+ YY_BUFFER_STATE yy_create_buffer( file, size )
1308
+ FILE *file;
1309
+ int size;
1310
+ #endif
1311
+ {
1312
+ YY_BUFFER_STATE b;
1313
+
1314
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1315
+ if ( ! b )
1316
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1317
+
1318
+ b->yy_buf_size = size;
1319
+
1320
+ /* yy_ch_buf has to be 2 characters longer than the size given because
1321
+ * we need to put in 2 end-of-buffer characters.
1322
+ */
1323
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1324
+ if ( ! b->yy_ch_buf )
1325
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1326
+
1327
+ b->yy_is_our_buffer = 1;
1328
+
1329
+ yy_init_buffer( b, file );
1330
+
1331
+ return b;
1332
+ }
1333
+
1334
+
1335
+ #ifdef YY_USE_PROTOS
1336
+ void yy_delete_buffer( YY_BUFFER_STATE b )
1337
+ #else
1338
+ void yy_delete_buffer( b )
1339
+ YY_BUFFER_STATE b;
1340
+ #endif
1341
+ {
1342
+ if ( b == yy_current_buffer )
1343
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
1344
+
1345
+ if ( b->yy_is_our_buffer )
1346
+ yy_flex_free( (void *) b->yy_ch_buf );
1347
+
1348
+ yy_flex_free( (void *) b );
1349
+ }
1350
+
1351
+
1352
+ #ifndef YY_ALWAYS_INTERACTIVE
1353
+ #ifndef YY_NEVER_INTERACTIVE
1354
+ extern int isatty YY_PROTO(( int ));
1355
+ #endif
1356
+ #endif
1357
+
1358
+ #ifdef YY_USE_PROTOS
1359
+ void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1360
+ #else
1361
+ void yy_init_buffer( b, file )
1362
+ YY_BUFFER_STATE b;
1363
+ FILE *file;
1364
+ #endif
1365
+
1366
+
1367
+ {
1368
+ yy_flush_buffer( b );
1369
+
1370
+ b->yy_input_file = file;
1371
+ b->yy_fill_buffer = 1;
1372
+
1373
+ #if YY_ALWAYS_INTERACTIVE
1374
+ b->yy_is_interactive = 1;
1375
+ #else
1376
+ #if YY_NEVER_INTERACTIVE
1377
+ b->yy_is_interactive = 0;
1378
+ #else
1379
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1380
+ #endif
1381
+ #endif
1382
+ }
1383
+
1384
+
1385
+ #ifdef YY_USE_PROTOS
1386
+ void yy_flush_buffer( YY_BUFFER_STATE b )
1387
+ #else
1388
+ void yy_flush_buffer( b )
1389
+ YY_BUFFER_STATE b;
1390
+ #endif
1391
+
1392
+ {
1393
+ b->yy_n_chars = 0;
1394
+
1395
+ /* We always need two end-of-buffer characters. The first causes
1396
+ * a transition to the end-of-buffer state. The second causes
1397
+ * a jam in that state.
1398
+ */
1399
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1400
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1401
+
1402
+ b->yy_buf_pos = &b->yy_ch_buf[0];
1403
+
1404
+ b->yy_at_bol = 1;
1405
+ b->yy_buffer_status = YY_BUFFER_NEW;
1406
+
1407
+ if ( b == yy_current_buffer )
1408
+ yy_load_buffer_state();
1409
+ }
1410
+
1411
+
1412
+ #ifndef YY_NO_SCAN_BUFFER
1413
+ #ifdef YY_USE_PROTOS
1414
+ YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1415
+ #else
1416
+ YY_BUFFER_STATE yy_scan_buffer( base, size )
1417
+ char *base;
1418
+ yy_size_t size;
1419
+ #endif
1420
+ {
1421
+ YY_BUFFER_STATE b;
1422
+
1423
+ if ( size < 2 ||
1424
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
1425
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
1426
+ /* They forgot to leave room for the EOB's. */
1427
+ return 0;
1428
+
1429
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1430
+ if ( ! b )
1431
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1432
+
1433
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1434
+ b->yy_buf_pos = b->yy_ch_buf = base;
1435
+ b->yy_is_our_buffer = 0;
1436
+ b->yy_input_file = 0;
1437
+ b->yy_n_chars = b->yy_buf_size;
1438
+ b->yy_is_interactive = 0;
1439
+ b->yy_at_bol = 1;
1440
+ b->yy_fill_buffer = 0;
1441
+ b->yy_buffer_status = YY_BUFFER_NEW;
1442
+
1443
+ yy_switch_to_buffer( b );
1444
+
1445
+ return b;
1446
+ }
1447
+ #endif
1448
+
1449
+
1450
+ #ifndef YY_NO_SCAN_STRING
1451
+ #ifdef YY_USE_PROTOS
1452
+ YY_BUFFER_STATE yy_scan_string( const char *str )
1453
+ #else
1454
+ YY_BUFFER_STATE yy_scan_string( str )
1455
+ const char *str;
1456
+ #endif
1457
+ {
1458
+ int len;
1459
+ for ( len = 0; str[len]; ++len )
1460
+ ;
1461
+
1462
+ return yy_scan_bytes( str, len );
1463
+ }
1464
+ #endif
1465
+
1466
+
1467
+ #ifndef YY_NO_SCAN_BYTES
1468
+ #ifdef YY_USE_PROTOS
1469
+ YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len )
1470
+ #else
1471
+ YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1472
+ const char *bytes;
1473
+ int len;
1474
+ #endif
1475
+ {
1476
+ YY_BUFFER_STATE b;
1477
+ char *buf;
1478
+ yy_size_t n;
1479
+ int i;
1480
+
1481
+ /* Get memory for full buffer, including space for trailing EOB's. */
1482
+ n = len + 2;
1483
+ buf = (char *) yy_flex_alloc( n );
1484
+ if ( ! buf )
1485
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1486
+
1487
+ for ( i = 0; i < len; ++i )
1488
+ buf[i] = bytes[i];
1489
+
1490
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1491
+
1492
+ b = yy_scan_buffer( buf, n );
1493
+ if ( ! b )
1494
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1495
+
1496
+ /* It's okay to grow etc. this buffer, and we should throw it
1497
+ * away when we're done.
1498
+ */
1499
+ b->yy_is_our_buffer = 1;
1500
+
1501
+ return b;
1502
+ }
1503
+ #endif
1504
+
1505
+
1506
+ #ifndef YY_NO_PUSH_STATE
1507
+ #ifdef YY_USE_PROTOS
1508
+ static void yy_push_state( int new_state )
1509
+ #else
1510
+ static void yy_push_state( new_state )
1511
+ int new_state;
1512
+ #endif
1513
+ {
1514
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
1515
+ {
1516
+ yy_size_t new_size;
1517
+
1518
+ yy_start_stack_depth += YY_START_STACK_INCR;
1519
+ new_size = yy_start_stack_depth * sizeof( int );
1520
+
1521
+ if ( ! yy_start_stack )
1522
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
1523
+
1524
+ else
1525
+ yy_start_stack = (int *) yy_flex_realloc(
1526
+ (void *) yy_start_stack, new_size );
1527
+
1528
+ if ( ! yy_start_stack )
1529
+ YY_FATAL_ERROR(
1530
+ "out of memory expanding start-condition stack" );
1531
+ }
1532
+
1533
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
1534
+
1535
+ BEGIN(new_state);
1536
+ }
1537
+ #endif
1538
+
1539
+
1540
+ #ifndef YY_NO_POP_STATE
1541
+ static void yy_pop_state()
1542
+ {
1543
+ if ( --yy_start_stack_ptr < 0 )
1544
+ YY_FATAL_ERROR( "start-condition stack underflow" );
1545
+
1546
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
1547
+ }
1548
+ #endif
1549
+
1550
+
1551
+ #ifndef YY_NO_TOP_STATE
1552
+ static int yy_top_state()
1553
+ {
1554
+ return yy_start_stack[yy_start_stack_ptr - 1];
1555
+ }
1556
+ #endif
1557
+
1558
+ #ifndef YY_EXIT_FAILURE
1559
+ #define YY_EXIT_FAILURE 2
1560
+ #endif
1561
+
1562
+ #ifdef YY_USE_PROTOS
1563
+ static void yy_fatal_error( const char msg[] )
1564
+ #else
1565
+ static void yy_fatal_error( msg )
1566
+ char msg[];
1567
+ #endif
1568
+ {
1569
+ (void) fprintf( stderr, "%s\n", msg );
1570
+ exit( YY_EXIT_FAILURE );
1571
+ }
1572
+
1573
+
1574
+
1575
+ /* Redefine yyless() so it works in section 3 code. */
1576
+
1577
+ #undef yyless
1578
+ #define yyless(n) \
1579
+ do \
1580
+ { \
1581
+ /* Undo effects of setting up yytext. */ \
1582
+ yytext[yyleng] = yy_hold_char; \
1583
+ yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
1584
+ yy_hold_char = *yy_c_buf_p; \
1585
+ *yy_c_buf_p = '\0'; \
1586
+ yyleng = n; \
1587
+ } \
1588
+ while ( 0 )
1589
+
1590
+
1591
+ /* Internal utility routines. */
1592
+
1593
+ #ifndef yytext_ptr
1594
+ #ifdef YY_USE_PROTOS
1595
+ static void yy_flex_strncpy( char *s1, const char *s2, int n )
1596
+ #else
1597
+ static void yy_flex_strncpy( s1, s2, n )
1598
+ char *s1;
1599
+ const char *s2;
1600
+ int n;
1601
+ #endif
1602
+ {
1603
+ register int i;
1604
+ for ( i = 0; i < n; ++i )
1605
+ s1[i] = s2[i];
1606
+ }
1607
+ #endif
1608
+
1609
+
1610
+ #ifdef YY_USE_PROTOS
1611
+ static void *yy_flex_alloc( yy_size_t size )
1612
+ #else
1613
+ static void *yy_flex_alloc( size )
1614
+ yy_size_t size;
1615
+ #endif
1616
+ {
1617
+ return (void *) malloc( size );
1618
+ }
1619
+
1620
+ #if 0 /* --DS */
1621
+ #ifdef YY_USE_PROTOS
1622
+ static void *yy_flex_realloc( void *ptr, yy_size_t size )
1623
+ #else
1624
+ static void *yy_flex_realloc( ptr, size )
1625
+ void *ptr;
1626
+ yy_size_t size;
1627
+ #endif
1628
+ {
1629
+ return (void *) realloc( ptr, size );
1630
+ }
1631
+ #endif /* --DS */
1632
+
1633
+ #ifdef YY_USE_PROTOS
1634
+ static void yy_flex_free( void *ptr )
1635
+ #else
1636
+ static void yy_flex_free( ptr )
1637
+ void *ptr;
1638
+ #endif
1639
+ {
1640
+ free( ptr );
1641
+ }
1642
+
1643
+ #if YY_MAIN
1644
+ int main()
1645
+ {
1646
+ yylex();
1647
+ return 0;
1648
+ }
1649
+ #endif
1650
+ /* #line 68 "pp_lexer.fl" --DS */
1651
+
1652
+
1653
+ /************************ exported functions ******************************/
1654
+
1655
+ PPLexTable *pp_lexer_open(FILE *f)
1656
+ {
1657
+ PPLexTable *lt;
1658
+ if (f == NULL)
1659
+ {
1660
+ prt_error("Fatal Error: pp_lexer_open: passed a NULL file pointer");
1661
+ exit(1);
1662
+ }
1663
+ yyin = f; /* redirect lex to look at the specified file */
1664
+ lt = (PPLexTable*) xalloc (sizeof(PPLexTable));
1665
+ setup(lt);
1666
+ clt = lt; /* set lt to be the current table, which yylex will fill in */
1667
+ yylex();
1668
+ clt = NULL;
1669
+ lt->idx_of_active_label=-1;
1670
+ return lt;
1671
+ }
1672
+
1673
+ void pp_lexer_close(PPLexTable *lt)
1674
+ {
1675
+ int i;
1676
+ pp_label_node *node,*next;
1677
+ for (i=0; i<PP_LEXER_MAX_LABELS; i++)
1678
+ {
1679
+ /* free the linked list */
1680
+ node = lt->nodes_of_label[i];
1681
+ while (node)
1682
+ {
1683
+ next = node->next;
1684
+ xfree(node, sizeof(pp_label_node));
1685
+ node=next;
1686
+ }
1687
+ }
1688
+ string_set_delete(lt->string_set);
1689
+ xfree(lt, sizeof(PPLexTable));
1690
+ }
1691
+
1692
+ int pp_lexer_set_label(PPLexTable *lt, const char *label)
1693
+ {
1694
+ /* set lexer state to first node of this label */
1695
+ lt->idx_of_active_label = get_index_of_label(lt, label);
1696
+ if (lt->idx_of_active_label==-1) return 0; /* label not found */
1697
+ lt->current_node_of_active_label=lt->nodes_of_label[lt->idx_of_active_label];
1698
+ return 1;
1699
+ }
1700
+
1701
+ int pp_lexer_count_tokens_of_label(PPLexTable *lt)
1702
+ {
1703
+ /* counts all tokens, even the commas */
1704
+ int n;
1705
+ pp_label_node *p;
1706
+ if (lt->idx_of_active_label==-1)
1707
+ {
1708
+ prt_error("Fatal Error: pp_lexer: current label is invalid");
1709
+ exit(1);
1710
+ }
1711
+ for (n=0, p=lt->nodes_of_label[lt->idx_of_active_label]; p;p=p->next, n++){}
1712
+ return n;
1713
+ }
1714
+
1715
+
1716
+ const char *pp_lexer_get_next_token_of_label(PPLexTable *lt)
1717
+ {
1718
+ /* retrieves next token of set label, or NULL if list exhausted */
1719
+ static const char *p;
1720
+ if (lt->current_node_of_active_label==NULL) return NULL;
1721
+ p = lt->current_node_of_active_label->str;
1722
+ lt->current_node_of_active_label=lt->current_node_of_active_label->next;
1723
+ return p;
1724
+ }
1725
+
1726
+ int pp_lexer_count_commas_of_label(PPLexTable *lt)
1727
+ {
1728
+ int n;
1729
+ pp_label_node *p;
1730
+ if (lt->idx_of_active_label==-1)
1731
+ {
1732
+ prt_error("Fatal Error: pp_lexer: current label is invalid");
1733
+ exit(1);
1734
+ }
1735
+ for (n=0,p=lt->nodes_of_label[lt->idx_of_active_label];p!=NULL;p=p->next)
1736
+ if (!strcmp(p->str, ",")) n++;
1737
+ return n;
1738
+ }
1739
+
1740
+ const char **pp_lexer_get_next_group_of_tokens_of_label(PPLexTable *lt, int *n_tokens)
1741
+ {
1742
+ /* all tokens until next comma, null-terminated */
1743
+ int n;
1744
+ pp_label_node *p;
1745
+ static const char **tokens = NULL;
1746
+ static int extents=0;
1747
+
1748
+ p=lt->current_node_of_active_label;
1749
+ for (n=0; p!=NULL && strcmp(p->str,","); n++, p=p->next) {}
1750
+ if (n>extents) {
1751
+ extents = n;
1752
+ free (tokens);
1753
+ tokens = (const char **) malloc (extents * sizeof(const char*));
1754
+ }
1755
+
1756
+ p = lt->current_node_of_active_label;
1757
+ for (n=0; p!=NULL && strcmp(p->str,","); n++, p=p->next)
1758
+ tokens[n] = string_set_add(p->str, lt->string_set);
1759
+
1760
+ /* advance "current node of label" state */
1761
+ lt->current_node_of_active_label = p;
1762
+ if (p!=NULL) lt->current_node_of_active_label = p->next;
1763
+
1764
+ *n_tokens = n;
1765
+ return tokens;
1766
+ }
1767
+
1768
+
1769
+ int yywrap(void)
1770
+ {
1771
+ /* must return 1 for end of input, 0 otherwise */
1772
+ return 1;
1773
+ }
1774
+
1775
+ /********************** non-exported functions ************************/
1776
+
1777
+ static void setup(PPLexTable *lt)
1778
+ {
1779
+ int i;
1780
+ for (i=0; i<PP_LEXER_MAX_LABELS; i++)
1781
+ {
1782
+ lt->nodes_of_label[i] = NULL;
1783
+ lt->last_node_of_label[i] = NULL;
1784
+ lt->labels[i]=NULL;
1785
+ }
1786
+ lt->string_set = string_set_create();
1787
+ }
1788
+
1789
+ static void set_label(PPLexTable *lt, const char *label)
1790
+ {
1791
+ int i;
1792
+ char *c;
1793
+ char *label_sans_colon;
1794
+
1795
+ /* check for and then slice off the trailing colon */
1796
+ label_sans_colon = strdup(label);
1797
+ c=&(label_sans_colon[strlen(label_sans_colon)-1]);
1798
+ if (*c != ':')
1799
+ {
1800
+ prt_error("Fatal Error: Label %s must end with :", label);
1801
+ exit(1);
1802
+ }
1803
+ *c = 0;
1804
+
1805
+ /* have we seen this label already? If so, abort */
1806
+ for (i=0;lt->labels[i]!=NULL && strcmp(lt->labels[i],label_sans_colon);i++) {}
1807
+ if (lt->labels[i]!=NULL)
1808
+ {
1809
+ prt_error("Fatal Error: pp_lexer: label %s multiply defined!", label_sans_colon);
1810
+ exit(1);
1811
+ }
1812
+
1813
+ /* new label. Store it */
1814
+ if (i == PP_LEXER_MAX_LABELS-1)
1815
+ {
1816
+ prt_error("Fatal Error: pp_lexer: too many labels. Raise PP_LEXER_MAX_LABELS");
1817
+ exit(1);
1818
+ }
1819
+ lt->labels[i] = string_set_add(label_sans_colon, lt->string_set);
1820
+ lt->idx_of_active_label = i;
1821
+
1822
+ free(label_sans_colon);
1823
+ }
1824
+
1825
+
1826
+ static void add_string_to_label(PPLexTable *lt, const char *str)
1827
+ {
1828
+ /* add the single string str to the set of strings associated with label */
1829
+ pp_label_node *new_node;
1830
+
1831
+ if (lt->idx_of_active_label == -1)
1832
+ {
1833
+ prt_error("Fatal Error: pp_lexer: invalid syntax (line %i)",yylineno);
1834
+ exit(1);
1835
+ }
1836
+
1837
+ /* make sure string is legal */
1838
+ check_string(str);
1839
+
1840
+ /* create a new node in (as yet to be determined) linked list of strings */
1841
+ new_node = (pp_label_node *) xalloc (sizeof(pp_label_node));
1842
+ new_node->str = string_set_add(str, lt->string_set);
1843
+ new_node->next = NULL;
1844
+
1845
+ /* stick newly-created node at the *end* of the appropriate linked list */
1846
+ if (lt->last_node_of_label[lt->idx_of_active_label]==NULL)
1847
+ {
1848
+ /* first entry on linked list */
1849
+ lt->nodes_of_label[lt->idx_of_active_label] = new_node;
1850
+ lt->last_node_of_label[lt->idx_of_active_label] = new_node;
1851
+ }
1852
+ else
1853
+ {
1854
+ /* non-first entry on linked list */
1855
+ lt->last_node_of_label[lt->idx_of_active_label]->next = new_node;
1856
+ lt->last_node_of_label[lt->idx_of_active_label] = new_node;
1857
+ }
1858
+ }
1859
+
1860
+ static void add_set_of_strings_to_label(PPLexTable *lt,const char *label_of_set)
1861
+ {
1862
+ /* add the set of strings, defined earlier by label_of_set, to the set of
1863
+ strings associated with the current label */
1864
+ pp_label_node *p;
1865
+ int idx_of_label_of_set;
1866
+ if (lt->idx_of_active_label==-1)
1867
+ {
1868
+ prt_error("Fatal Error: pp_lexer: invalid syntax (line %i)",yylineno);
1869
+ exit(1);
1870
+ }
1871
+ if ((idx_of_label_of_set = get_index_of_label(lt, label_of_set))==-1)
1872
+ {
1873
+ prt_error("Fatal Error: pp_lexer: label %s must be defined before it's referred to (line %i)"
1874
+ ,label_of_set, yylineno);
1875
+ exit(1);
1876
+ }
1877
+ for (p=lt->nodes_of_label[idx_of_label_of_set]; p!=NULL; p=p->next)
1878
+ add_string_to_label(lt, p->str);
1879
+ }
1880
+
1881
+ #if 0
1882
+ /* --DS */
1883
+ static void show_bindings(PPLexTable *lt)
1884
+ {
1885
+ /* Diagnostic. Show contents of knowledge file, as arranged internally */
1886
+ int i,j;
1887
+ char *la;
1888
+ pp_label_node *p;
1889
+ printf("The symbol table's contents: \n");
1890
+ for (i=0; (la=lt->labels[i])!=NULL; i++)
1891
+ {
1892
+ printf("\n\n%s\n", la);
1893
+ for (j=0; j<strlen(la); j++)
1894
+ printf("=");
1895
+ printf("\n");
1896
+ for (p=lt->nodes_of_label[i]; p!=NULL; p=p->next)
1897
+ printf(" %s ", p->str);
1898
+ }
1899
+ printf("\n");
1900
+ }
1901
+ #endif
1902
+
1903
+ static int get_index_of_label(PPLexTable *lt, const char *label)
1904
+ {
1905
+ int i;
1906
+ for (i=0; lt->labels[i]!=NULL; i++)
1907
+ if (!strcmp(lt->labels[i], label)) return i;
1908
+ return -1;
1909
+ }
1910
+
1911
+ static void check_string(const char *str)
1912
+ {
1913
+ if (strlen(str)>1 && strchr(str, ',')!=NULL)
1914
+ {
1915
+ prt_error("Fatal Error: pp_lexer: string %s contains a comma, which is a no-no.",str);
1916
+ exit(1);
1917
+ }
1918
+ }
1919
+
1920
+