Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

514 lines
17 KiB

  1. <GRAMMAR LANGID="409">
  2. <DEFINE>
  3. <ID NAME="BILLIONS" VAL="1"/>
  4. <ID NAME="MILLIONS" VAL="2"/>
  5. <ID NAME="THOUSANDS" VAL="3"/>
  6. <ID NAME="HUNDREDS" VAL="4"/>
  7. <ID NAME="TENS" VAL="5"/>
  8. <ID NAME="ONES" VAL="6"/>
  9. <ID NAME="TEENS" VAL="200"/>
  10. <ID NAME="NEGATIVE" VAL="7"/>
  11. <ID NAME="MILLBILL" VAL="8"/>
  12. <ID NAME="DIGIT" VAL="9"/>
  13. <ID NAME="TWODIGIT" VAL="10"/>
  14. <ID NAME="FP_PART" VAL="11"/>
  15. <ID NAME="ZERO" VAL="12"/>
  16. <ID NAME="POINT_ZERO" VAL="13"/>
  17. <ID NAME="DENOMINATOR" VAL="15"/>
  18. <ID NAME="WHOLE" VAL="16"/>
  19. <ID NAME="ONEDIGIT" VAL="17"/>
  20. <ID NAME="GRID_INTEGER_99" VAL="101"/>
  21. <ID NAME="GRID_INTEGER_999" VAL="102"/>
  22. <ID NAME="GRID_INTEGER_MILLBILL" VAL="103"/>
  23. <ID NAME="GRID_INTEGER_STANDALONE" VAL="104"/>
  24. <ID NAME="GRID_INTEGER" VAL="105"/>
  25. <ID NAME="GRID_INTEGER_NONNEG" VAL="106"/>
  26. <ID NAME="GRID_DIGIT_NUMBER" VAL="107"/>
  27. <ID NAME="GRID_FP_NUMBER" VAL="108"/>
  28. <ID NAME="GRID_FP_NUMBER_NONNEG" VAL="109"/>
  29. <ID NAME="GRID_NUMBER" VAL="110"/>
  30. </DEFINE>
  31. <!--
  32. GRID_NUMBER
  33. Includes all kinds of numbers, negative or positive, interger or decimal.
  34. -->
  35. <RULE NAME="GRID_NUMBER" ID="GRID_NUMBER" TOPLEVEL="ACTIVE" EXPORT="0">
  36. <LN>
  37. <P WEIGHT="1000.01">zhoulotskunosprok</P>
  38. <P WEIGHT="1.01">Force Num
  39. <O>
  40. <RULEREF NAME="NEGATIVE" PROPNAME="NEGATIVE" PROPID="NEGATIVE"/>
  41. </O>
  42. <L>
  43. <RULEREF NAME="GRID_INTEGER_STANDALONE" PROPNAME="GRID_INTEGER_STANDALONE" PROPID="GRID_INTEGER_STANDALONE"/>
  44. <RULEREF NAME="fp_number_nonneg" PROPNAME="GRID_FP_NUMBER" PROPID="GRID_FP_NUMBER"/>
  45. </L>
  46. </P>
  47. </LN>
  48. </RULE>
  49. <!--
  50. INTEGER_STANDALONE
  51. A INTEGER_STANDALONE can be in the range (-1e12, 1e12) and will always be
  52. called as a toplevel rule.
  53. This rule is not referenced by any other rules.
  54. -->
  55. <RULE NAME="GRID_INTEGER_STANDALONE" ID="GRID_INTEGER_STANDALONE" TOPLEVEL="INACTIVE" EXPORT="1">
  56. <L>
  57. <P>
  58. <RULEREF NAME="GRID_INTEGER_MILLBILL" PROPNAME="GRID_INTEGER_MILLBILL" PROPID="GRID_INTEGER_MILLBILL"/>
  59. </P>
  60. <P>
  61. <RULEREF NAME="integer_base_nonneg"/>
  62. </P>
  63. </L>
  64. </RULE>
  65. <!--
  66. INTEGER_MILLBILL
  67. Numbers for which the word "million" or "billion" should be displayed
  68. -->
  69. <RULE NAME="GRID_INTEGER_MILLBILL" ID="GRID_INTEGER_MILLBILL" TOPLEVEL="INACTIVE" EXPORT="1">
  70. <L>
  71. <P>
  72. <RULEREF NAME="GRID_INTEGER_99" PROPNAME="GRID_INTEGER_99" PROPID="GRID_INTEGER_99"/>
  73. </P>
  74. <P>
  75. <RULEREF NAME="GRID_FP_NUMBER_NONNEG" PROPNAME="GRID_FP_NUMBER_NONNEG" PROPID="GRID_FP_NUMBER_NONNEG"/>
  76. </P>
  77. </L>
  78. <LN PROPNAME="MILLBILL" PROPID="MILLBILL">
  79. <PN VAL="MILLIONS" VALSTR="million">million</PN>
  80. <PN VAL="BILLIONS" VALSTR="billion">billion</PN>
  81. </LN>
  82. </RULE>
  83. <!--
  84. INTEGER_99
  85. Numbers in [0, 100)
  86. Toplevel inactive but can be imported
  87. -->
  88. <RULE NAME="GRID_INTEGER_99" ID="GRID_INTEGER_99" TOPLEVEL="INACTIVE" EXPORT="1">
  89. <RULEREF NAME="cardinal_99" PROPNAME="ONES" PROPID="ONES"/>
  90. </RULE>
  91. <!--
  92. INTEGER_999
  93. Numbers in [0, 1000)
  94. Toplevel inactive but can be imported
  95. -->
  96. <RULE NAME="GRID_INTEGER_999" ID="GRID_INTEGER_999" TOPLEVEL="INACTIVE" EXPORT="1">
  97. <RULEREF NAME="cardinal_999" PROPNAME="ONES" PROPID="ONES"/>
  98. </RULE>
  99. <!--
  100. integer_base_nonneg
  101. Same as above except nonnegative
  102. -->
  103. <RULE NAME="integer_base_nonneg">
  104. <L>
  105. <P>
  106. <RULEREF NAME="cardinal"/>
  107. </P>
  108. <P>
  109. <RULEREF NAME="GRID_DIGIT_NUMBER" PROPNAME="GRID_DIGIT_NUMBER" PROPID="GRID_DIGIT_NUMBER"/>
  110. </P>
  111. </L>
  112. </RULE>
  113. <!--
  114. cardinal
  115. A cardinal is defined here as a number in [0, 1e12), properly
  116. formed (not spoken digit by digit)
  117. -->
  118. <RULE NAME="cardinal">
  119. <L>
  120. <P>
  121. <L>
  122. <P>
  123. <RULEREF NAME="big_part"/>
  124. </P>
  125. </L>
  126. <O>
  127. <O>
  128. and
  129. </O>
  130. <P>
  131. <!-- cardinal_999 part optional if the big_part is present -->
  132. <RULEREF NAME="cardinal_999" PROPNAME="ONES" PROPID="ONES" VAL="1"/>
  133. </P>
  134. </O>
  135. </P>
  136. <P>
  137. <P>
  138. <RULEREF NAME="cardinal_99_nonzero" PROPNAME="HUNDREDS" PROPID="HUNDREDS" VAL="1"/>
  139. </P>
  140. <P>
  141. hundred
  142. </P>
  143. <O>
  144. <O>
  145. and
  146. </O>
  147. <P>
  148. <RULEREF NAME="cardinal_99_nonzero" PROPNAME="ONES" PROPID="ONES" VAL="1"/>
  149. </P>
  150. </O>
  151. </P>
  152. <P>
  153. <!-- cardinal_999 part mandatory if the big_part is not present.
  154. In this case, the cardinal_999 part must be at least 20 -->
  155. <RULEREF NAME="cardinal_999" PROPNAME="ONES" PROPID="ONES" VAL="1"/>
  156. </P>
  157. </L>
  158. </RULE>
  159. <!--
  160. big_part
  161. A big_part is the part of a spoken number that is divisible by 1000. It
  162. has to be in the range (-1e12, 1e12).
  163. -->
  164. <RULE NAME="big_part">
  165. <L>
  166. <P>
  167. <RULEREF NAME="cardinal_999" PROPNAME="BILLIONS" PROPID="BILLIONS"/>
  168. <P> billion </P>
  169. <!-- billions are present, so millions and thousands are optional -->
  170. <O>
  171. <RULEREF NAME="cardinal_999" PROPNAME="MILLIONS" PROPID="MILLIONS"/>
  172. <P> million </P>
  173. </O>
  174. <O>
  175. <RULEREF NAME="cardinal_999" PROPNAME="THOUSANDS" PROPID="THOUSANDS"/>
  176. <P> thousand </P>
  177. </O>
  178. </P>
  179. <P>
  180. <RULEREF NAME="cardinal_999" PROPNAME="MILLIONS" PROPID="MILLIONS"/>
  181. <P> million </P>
  182. <!-- millions are present, so thousands are optional -->
  183. <O>
  184. <RULEREF NAME="cardinal_999" PROPNAME="THOUSANDS" PROPID="THOUSANDS"/>
  185. <P> thousand </P>
  186. </O>
  187. </P>
  188. <P>
  189. <!-- billions and millions not present, so thousands are mandatory -->
  190. <RULEREF NAME="cardinal_999" PROPNAME="THOUSANDS" PROPID="THOUSANDS"/>
  191. <P> thousand </P>
  192. </P>
  193. </L>
  194. </RULE>
  195. <!--
  196. cardinal_999
  197. This is defined as a number in [0,1000).
  198. -->
  199. <RULE NAME="cardinal_999">
  200. <L>
  201. <P PROPNAME="ZERO" PROPID="ZERO" VAL="0">
  202. zero
  203. </P>
  204. <P>
  205. <!-- A number between 1 and 19 -->
  206. <RULEREF NAME="onesfrag" PROPNAME="ONES" VAL="1"/>
  207. </P>
  208. <P>
  209. <!-- A "tens" number (20, 30,...) -->
  210. <RULEREF NAME="tensfrag" PROPNAME="TENS" VAL="10"/>
  211. <O>
  212. <!-- Can be followed by a nonzero digit -->
  213. <RULEREF NAME="digit_nonzero" PROPNAME="ONES" VAL="1"/>
  214. </O>
  215. </P>
  216. <P>
  217. <!-- A number at least 100 -->
  218. <RULEREF NAME="hundredsfrag" PROPNAME="HUNDREDS" VAL="100"/>
  219. <!-- optionally followed by tens and ones places -->
  220. <O>
  221. <L>
  222. <P>
  223. <!-- e.g. six hundred thirteen -->
  224. <!-- Note that this case is not covered by the later case -->
  225. <RULEREF NAME="onesfrag" PROPNAME="ONES" VAL="1"/>
  226. </P>
  227. <P>
  228. <!-- e.g. six hundred thirty two -->
  229. <RULEREF NAME="tensfrag" PROPNAME="TENS" VAL="10"/>
  230. <O>
  231. <!-- ones place optional -->
  232. <RULEREF NAME="digit_nonzero" PROPNAME="ONES" VAL="1"/>
  233. </O>
  234. </P>
  235. </L>
  236. </O>
  237. </P>
  238. </L>
  239. </RULE>
  240. <!--
  241. cardinal_99
  242. Defined as any integer in [0,100)
  243. -->
  244. <RULE NAME="cardinal_99">
  245. <L>
  246. <P>
  247. <RULEREF NAME="cardinal_99_nonzero"/>
  248. </P>
  249. <P>
  250. <RULEREF NAME="zero"/>
  251. </P>
  252. </L>
  253. </RULE>
  254. <RULE NAME="cardinal_99_nonzero">
  255. <L>
  256. <P>
  257. <RULEREF NAME="tensfrag" PROPNAME="TENS" VAL="10"/>
  258. <O><RULEREF NAME="digit_nonzero" PROPNAME="ONES" VAL="1"/></O>
  259. </P>
  260. <P> <RULEREF NAME="onesfrag" PROPNAME="ONES" VAL="1"/> </P>
  261. </L>
  262. </RULE>
  263. <RULE NAME="NEGATIVE">
  264. <L>
  265. <P>
  266. negative
  267. </P>
  268. <P>
  269. minus
  270. </P>
  271. </L>
  272. </RULE>
  273. <RULE NAME="twodigit">
  274. <L>
  275. <P>
  276. <P>
  277. <RULEREF NAME="tensfrag" PROPNAME="TENS" PROPID="TENS" VAL="10"/>
  278. </P>
  279. <O>
  280. <RULEREF NAME="digit_nonzero" PROPNAME="ONES" PROPID="ONES" VAL="1"/>
  281. </O>
  282. </P>
  283. <P>
  284. <RULEREF NAME="onesfrag_teens" PROPNAME="TEENS" PROPID="TEENS" VAL="1"/>
  285. </P>
  286. </L>
  287. </RULE>
  288. <RULE NAME="hundredsfrag">
  289. <L>
  290. <LN PROPNAME="HUNDREDS" PROPID="HUNDREDS">
  291. <PN VAL="1" VALSTR="1">a</PN>
  292. </LN>
  293. <P>
  294. <RULEREF NAME="digit_nonzero"/>
  295. </P>
  296. </L>
  297. <P>
  298. hundred ?and
  299. </P>
  300. </RULE>
  301. <RULE NAME="tensfrag">
  302. <LN PROPNAME="TENS" PROPID="TENS">
  303. <PN VAL="2" VALSTR="2">twenty</PN>
  304. <PN VAL="3" VALSTR="3">thirty</PN>
  305. <PN VAL="4" VALSTR="4">forty</PN>
  306. <PN VAL="5" VALSTR="5">fifty</PN>
  307. <PN VAL="6" VALSTR="6">sixty</PN>
  308. <PN VAL="7" VALSTR="7">seventy</PN>
  309. <PN VAL="8" VALSTR="8">eighty</PN>
  310. <PN VAL="9" VALSTR="9">ninety</PN>
  311. </LN>
  312. </RULE>
  313. <RULE NAME="onesfrag">
  314. <L>
  315. <P>
  316. <RULEREF NAME="digit_nonzero"/>
  317. </P>
  318. <P>
  319. <RULEREF NAME="onesfrag_teens"/>
  320. </P>
  321. </L>
  322. </RULE>
  323. <RULE NAME="onesfrag_teens">
  324. <LN PROPNAME="ONES" PROPID="ONES">
  325. <PN VAL="10" VALSTR="10">ten</PN>
  326. <PN VAL="11" VALSTR="11">eleven</PN>
  327. <PN VAL="12" VALSTR="12">twelve</PN>
  328. <PN VAL="13" VALSTR="13">thirteen</PN>
  329. <PN VAL="14" VALSTR="14">fourteen</PN>
  330. <PN VAL="15" VALSTR="15">fifteen</PN>
  331. <PN VAL="16" VALSTR="16">sixteen</PN>
  332. <PN VAL="17" VALSTR="17">seventeen</PN>
  333. <PN VAL="18" VALSTR="18">eighteen</PN>
  334. <PN VAL="19" VALSTR="19">nineteen</PN>
  335. </LN>
  336. </RULE>
  337. <RULE NAME="onesfrag_or_zero">
  338. <L>
  339. <P>
  340. <RULEREF NAME="zero"/>
  341. </P>
  342. <P>
  343. <RULEREF NAME="onesfrag"/>
  344. </P>
  345. </L>
  346. </RULE>
  347. <RULE NAME="digit_nonzero_or_one">
  348. <LN PROPNAME="DIGIT" PROPID="DIGIT">
  349. <PN VAL="2" VALSTR="2">two</PN>
  350. <PN VAL="3" VALSTR="3">three</PN>
  351. <PN VAL="4" VALSTR="4">four</PN>
  352. <PN VAL="5" VALSTR="5">five</PN>
  353. <PN VAL="6" VALSTR="6">six</PN>
  354. <PN VAL="7" VALSTR="7">seven</PN>
  355. <PN VAL="8" VALSTR="8">eight</PN>
  356. <PN VAL="9" VALSTR="9">nine</PN>
  357. </LN>
  358. </RULE>
  359. <RULE NAME="digit_nonzero">
  360. <L>
  361. <LN PROPNAME="DIGIT" PROPID="DIGIT">
  362. <PN VAL="1" VALSTR="1">one</PN>
  363. </LN>
  364. <P>
  365. <RULEREF NAME="digit_nonzero_or_one"/>
  366. </P>
  367. </L>
  368. </RULE>
  369. <RULE NAME="digit">
  370. <L>
  371. <LN PROPNAME="DIGIT" PROPID="DIGIT">
  372. <PN VAL="0" VALSTR="0">zero</PN>
  373. <PN VAL="0" VALSTR="0">oh</PN>
  374. </LN>
  375. <P>
  376. <RULEREF NAME="digit_nonzero"/>
  377. </P>
  378. </L>
  379. </RULE>
  380. <RULE NAME="zero">
  381. <LN PROPNAME="ONES" PROPID="ONES">
  382. <PN VAL="0" VALSTR="0">zero</PN>
  383. </LN>
  384. </RULE>
  385. <!--
  386. DIGIT_NUMBER
  387. Integers in (0, 1e12), spelled out either one digit at a time or two digits
  388. at a time.
  389. This rule is an INACTIVE toplevel rule, since it should go through GRID_INTEGER
  390. to be formatted.
  391. Explicitly disallow TWODIGIT DIGIT since that is ambiguous with "twenty five"
  392. -->
  393. <RULE NAME="GRID_DIGIT_NUMBER" ID="GRID_DIGIT_NUMBER" TOPLEVEL="INACTIVE" EXPORT="1">
  394. <L>
  395. <P MIN="3" MAX="12">
  396. <L>
  397. <P>
  398. <RULEREF NAME="twodigit" PROPNAME="TWODIGIT" PROPID="TWODIGIT"/>
  399. </P>
  400. <P>
  401. <RULEREF NAME="digit" PROPNAME="ONEDIGIT" PROPID="ONEDIGIT"/>
  402. </P>
  403. </L>
  404. </P>
  405. <P>
  406. <P>
  407. <RULEREF NAME="digit" PROPNAME="ONEDIGIT" PROPID="ONEDIGIT"/>
  408. </P>
  409. <P>
  410. <RULEREF NAME="twodigit" PROPNAME="TWODIGIT" PROPID="TWODIGIT"/>
  411. </P>
  412. </P>
  413. <P MIN="2" MAX="2">
  414. <RULEREF NAME="twodigit" PROPNAME="TWODIGIT" PROPID="TWODIGIT"/>
  415. </P>
  416. <P MIN="2" MAX="2">
  417. <RULEREF NAME="digit" PROPNAME="ONEDIGIT" PROPID="ONEDIGIT"/>
  418. </P>
  419. </L>
  420. </RULE>
  421. <!--
  422. fp_number_nonneg
  423. Floating-point numbers with up to 12 sig figs. Both the stuff to the left of the
  424. decimal point and the stuff to the right of the decimal point can be either
  425. NUMBERs or DIGIT_NUMBERs
  426. -->
  427. <RULE NAME="GRID_FP_NUMBER_NONNEG" ID="GRID_FP_NUMBER_NONNEG" TOPLEVEL="INACTIVE" EXPORT="1">
  428. <RULEREF NAME="fp_number_nonneg"/>
  429. </RULE>
  430. <RULE NAME="fp_number_nonneg">
  431. <O>
  432. <L>
  433. <P>
  434. <RULEREF NAME="GRID_INTEGER_NONNEG" PROPNAME="ONES" PROPID="ONES"/>
  435. </P>
  436. <P PROPNAME="ZERO" PROPID="ZERO" VAL="0">
  437. oh
  438. </P>
  439. </L>
  440. </O>
  441. <L>
  442. <P>
  443. point
  444. </P>
  445. <P>
  446. decimal
  447. </P>
  448. </L>
  449. <L>
  450. <P>
  451. <RULEREF NAME="GRID_DIGIT_BY_DIGIT" PROPNAME="FP_PART" PROPID="FP_PART"/>
  452. </P>
  453. <P>
  454. <RULEREF NAME="GRID_INTEGER_999" PROPNAME="FP_PART" PROPID="FP_PART"/>
  455. </P>
  456. <P PROPNAME="POINT_ZERO" PROPID="POINT_ZERO" VAL="0">
  457. oh
  458. </P>
  459. </L>
  460. </RULE>
  461. <!--
  462. INTEGER_NONNEG
  463. A INTEGER_NONNEG can be in the range [0, 1e12) and will never be called
  464. as a toplevel rule
  465. -->
  466. <RULE NAME="GRID_INTEGER_NONNEG" ID="GRID_INTEGER_NONNEG" TOPLEVEL="INACTIVE" EXPORT="1">
  467. <RULEREF NAME="integer_base_nonneg"/>
  468. </RULE>
  469. <!--
  470. GRID_DIGIT_BY_DIGIT
  471. GRID_DIGIT_BY_DIGIT will be used by fp_number_noneg as the floating part.
  472. it will never be called as a toplevel rule
  473. -->
  474. <RULE NAME="GRID_DIGIT_BY_DIGIT" TOPLEVEL="INACTIVE" EXPORT="1">
  475. <RULEREF NAME="GRID_DIGIT_NUMBER" PROPNAME="GRID_DIGIT_NUMBER" PROPID="GRID_DIGIT_NUMBER"/>
  476. </RULE>
  477. </GRAMMAR>