1 (*
2  * The contents of this file are subject to the Mozilla Public License
3  * Version 1.1 (the "License"); you may not use this file except in
4  * compliance with the License. You may obtain a copy of the License at
5  * http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
9  * License for the specific language governing rights and limitations
10  * under the License.
11  *
12  * The Initial Developer of this code is John Hansen.
13  * Portions created by John Hansen are Copyright (C) 2009 John Hansen.
14  * All Rights Reserved.
15  *
16  *)
17 unit uNBCLexer;
18 
19 interface
20 
21 uses
22   Classes, uGenLexer;
23 
24 type
25   TNBCSimpleLexer = class(TGenLexer)
26   protected
27     procedure InitForLanguage(Lex: TGenLexer); override;
28   end;
29 
30   TNBCLexer = class(TGenLexer)
31   protected
32     procedure InitForLanguage(Lex: TGenLexer); override;
33   end;
34 
35 implementation
36 
37 uses
38   SysUtils, mwGenericLex;
39 
40 { TNBCSimpleLexer }
41 
42 procedure TNBCSimpleLexer.InitForLanguage(Lex: TGenLexer);
43 var
44   Pat, OptPat: TAny;
45 begin
46   { Space}
47   Pat := TAny.Create(nil);
48   Pat.CharClass := [#1..#9, #11, #12, #14..#32];
49   Pat.Id := piSpace;
50   Lex.Add(Pat);
51 
52   { LineEnd}
53   Pat := TAny.Create(nil);
54   Pat.Kind := pkLineEnd;
55   Pat.Id := piLineEnd;
56   Pat.Max := 1;
57   Lex.Add(Pat);
58 
59   { Identifier}
60   Pat := TIdentifier.Create(nil);
61   Pat.CharClass := [#33..#126];
62   Lex.Add(Pat);
63 
64 
65   { Symbol, Comment }
66   Pat := TAny.Create(nil);
67   Pat.Key := '//';
68   Pat.Min := 1;
69   Lex.Add(Pat);
70   OptPat := TAny.Create(nil);
71   OptPat.Key := '/';
72   OptPat.Min := 1;
73   OptPat.Id := piSymbol;
74   Pat.AddOption(OptPat);
75   OptPat := TTillLineEnd.Create(Pat);
76   OptPat.Id := piComment;
77 
78   { Symbol, Comment }
79   Pat := TAny.Create(nil);
80   Pat.Key := ';';
81   Pat.Min := 1;
82   Pat.Id  := piComment;
83   Lex.Add(Pat);
84   OptPat := TTillLineEnd.Create(Pat);
85   OptPat.Id := piComment;
86 
87   { KeyWord, Identifier}
88   Pat := TAny.Create(nil);
89   Pat.Key:= 'subroutine';
90   Pat.Id:= piKeyWord;
91   Pat.Min:= 1;
92   TAlphaNumeric.Create(Pat);
93   Lex.Add(Pat);
94   Pat.AddOption(TIdentifier.Create(nil));
95 
96   { KeyWord, Identifier}
97   Pat := TAny.Create(nil);
98   Pat.Key:= 'thread';
99   Pat.Id:= piKeyWord;
100   Pat.Min:= 1;
101   TAlphaNumeric.Create(Pat);
102   Lex.Add(Pat);
103   Pat.AddOption(TIdentifier.Create(nil));
104 
105 end;
106 
107 { TNBCLexer }
108 
109 procedure TNBCLexer.InitForLanguage(Lex: TGenLexer);
110 var
111   Pat, OptPat, Temp: TAny;
112 begin
113   { Space}
114   Pat := TAny.Create(nil);
115   Pat.CharClass := [#1..#9, #11, #12, #14..#32];
116   Pat.Id := piSpace;
117   Lex.Add(Pat);
118 
119   { LineEnd}
120   Pat := TAny.Create(nil);
121   Pat.Kind := pkLineEnd;
122   Pat.Id := piLineEnd;
123   Pat.Max := 1;
124   Lex.Add(Pat);
125 
126   { Identifier}
127   Pat := TIdentifier.Create(nil);
128   Lex.Add(Pat);
129 
130   { String }
131   Pat := TAny.Create(nil);
132   Pat.Key := '"';
133   Lex.Add(Pat);
134   Pat := TAny.Create(Pat);
135   Pat.Key := '"';
136   Pat.Min := 1;
137   Pat.Max := 1;
138   Pat.Id := piString;
139   Pat.Kind := pkTillKey;
140   Temp:= Pat;
141   Pat := TAny.Create(Pat);
142   Pat.Key := '"';
143   Pat.Id := piBadString;
144   Pat.Min := 1;
145   Pat.Max := 1;
146   Pat.Regress := True;
147   Pat.ToRegress := Temp;
148 
149   { String }
150   Pat := TAny.Create(nil);
151   Pat.Key := '''';
152   Lex.Add(Pat);
153   Pat := TAny.Create(Pat);
154   Pat.Key := '''';
155   Pat.Min := 1;
156   Pat.Max := 1;
157   Pat.Id := piString;
158   Pat.Kind := pkTillKey;
159   Temp:= Pat;
160   Pat := TAny.Create(Pat);
161   Pat.Key := '''';
162   Pat.Id := piBadString;
163   Pat.Min := 1;
164   Pat.Max := 1;
165   Pat.Regress := True;
166   Pat.ToRegress := Temp;
167 
168   { Symbol, Comment }
169   Pat := TAny.Create(nil);
170   Pat.Key := '/*';
171   Pat.Min := 1;
172   Lex.Add(Pat);
173   OptPat := TAny.Create(nil);
174   OptPat.Key := '//';
175   OptPat.Id := piComment;
176   OptPat.Min := 1;
177   Pat.AddOption(OptPat);
178   OptPat := TTillLineEnd.Create(OptPat);
179   OptPat.Id := piComment;
180   OptPat := TAny.Create(nil);
181   OptPat.Key := '/';
182   OptPat.Min := 1;
183   OptPat.Id := piSymbol;
184   Pat.AddOption(OptPat);
185   Pat := TAny.Create(Pat);
186   Pat.Key := '*/';
187   Pat.Id := piComment;
188   Pat.Kind := pkTillKey;
189   Pat.MultiLine := True;
190 
191   { Symbol, Comment }
192   Pat := TAny.Create(nil);
193   Pat.Key := ';';
194   Pat.Min := 1;
195   Pat.Id  := piComment;
196   Lex.Add(Pat);
197   OptPat := TTillLineEnd.Create(Pat);
198   OptPat.Id := piComment;
199 
200   { Number }
201   Pat := TAny.Create(nil);
202   Pat.CharClass := ['1'..'9'];
203   Pat.Min := 1;
204   Pat.Id := piNumber;
205   Lex.Add(Pat);
206   Pat := TAny.Create(Pat);
207   Pat.CharClass := ['0'..'9'];
208   Pat.Id := piNumber;
209 
210   { Number }
211   Pat := TAny.Create(nil);
212   Pat.Key := '0x';
213   Pat.Id := piNumber;
214   Pat.Min := 1;
215   Pat.Max := 2;
216   Lex.Add(Pat);
217   OptPat := TAny.Create(nil);
218   OptPat.Key := '0';
219   OptPat.Min := 1;
220   OptPat.Id := piNumber;
221   Pat.AddOption(OptPat);
222   Pat := TAny.Create(Pat);
223   Pat.CharClass := ['0'..'9', 'A'..'F', 'a'..'f'];
224   Pat.Id := piNumber;
225 
226   { Symbol (VA_ARGS), Symbol (period)}
227   Pat := TAny.Create(nil);
228   Pat.Key:= '...';
229   Pat.Id:= piSymbol;
230   Pat.Min:= 1;
231   TAlphaNumeric.Create(Pat);
232   Lex.Add(Pat);
233   OptPat := TAny.Create(nil);
234   OptPat.Key := '.';
235   OptPat.Id:= piSymbol;
236   OptPat.Min:= 1;
237   Pat.AddOption(OptPat);
238   TAlphaNumeric.Create(OptPat);
239   Pat.AddOption(TIdentifier.Create(nil));
240 
241   { Directive, Identifier}
242   Pat := TAny.Create(nil);
243   Pat.Key:= '#download';
244   Pat.Id:= piDirective;
245   Pat.Min:= 1;
246   TAlphaNumeric.Create(Pat);
247   Lex.Add(Pat);
248   OptPat := TAny.Create(nil);
249   OptPat.Key := '#include';
250   OptPat.Id:= piDirective;
251   OptPat.Min:= 1;
252   Pat.AddOption(OptPat);
253   TAlphaNumeric.Create(OptPat);
254   OptPat := TAny.Create(nil);
255   OptPat.Key := '#define';
256   OptPat.Id:= piDirective;
257   OptPat.Min:= 1;
258   Pat.AddOption(OptPat);
259   TAlphaNumeric.Create(OptPat);
260   OptPat := TAny.Create(nil);
261   OptPat.Key := '#ifndef';
262   OptPat.Id:= piDirective;
263   OptPat.Min:= 1;
264   Pat.AddOption(OptPat);
265   TAlphaNumeric.Create(OptPat);
266   OptPat := TAny.Create(nil);
267   OptPat.Key := '#import';
268   OptPat.Id:= piDirective;
269   OptPat.Min:= 1;
270   Pat.AddOption(OptPat);
271   TAlphaNumeric.Create(OptPat);
272   OptPat := TAny.Create(nil);
273   OptPat.Key := '#pragma';
274   OptPat.Id:= piDirective;
275   OptPat.Min:= 1;
276   Pat.AddOption(OptPat);
277   TAlphaNumeric.Create(OptPat);
278   OptPat := TAny.Create(nil);
279   OptPat.Key := '#endif';
280   OptPat.Id:= piDirective;
281   OptPat.Min:= 1;
282   Pat.AddOption(OptPat);
283   TAlphaNumeric.Create(OptPat);
284   OptPat := TAny.Create(nil);
285   OptPat.Key := '#error';
286   OptPat.Id:= piDirective;
287   OptPat.Min:= 1;
288   Pat.AddOption(OptPat);
289   TAlphaNumeric.Create(OptPat);
290   OptPat := TAny.Create(nil);
291   OptPat.Key := '#ifdef';
292   OptPat.Id:= piDirective;
293   OptPat.Min:= 1;
294   Pat.AddOption(OptPat);
295   TAlphaNumeric.Create(OptPat);
296   OptPat := TAny.Create(nil);
297   OptPat.Key := '#reset';
298   OptPat.Id:= piDirective;
299   OptPat.Min:= 1;
300   Pat.AddOption(OptPat);
301   TAlphaNumeric.Create(OptPat);
302   OptPat := TAny.Create(nil);
303   OptPat.Key := '#undef';
304   OptPat.Id:= piDirective;
305   OptPat.Min:= 1;
306   Pat.AddOption(OptPat);
307   TAlphaNumeric.Create(OptPat);
308   OptPat := TAny.Create(nil);
309   OptPat.Key := '#elif';
310   OptPat.Id:= piDirective;
311   OptPat.Min:= 1;
312   Pat.AddOption(OptPat);
313   TAlphaNumeric.Create(OptPat);
314   OptPat := TAny.Create(nil);
315   OptPat.Key := '#else';
316   OptPat.Id:= piDirective;
317   OptPat.Min:= 1;
318   Pat.AddOption(OptPat);
319   TAlphaNumeric.Create(OptPat);
320   OptPat := TAny.Create(nil);
321   OptPat.Key := '#line';
322   OptPat.Id:= piDirective;
323   OptPat.Min:= 1;
324   Pat.AddOption(OptPat);
325   TAlphaNumeric.Create(OptPat);
326   OptPat := TAny.Create(nil);
327   OptPat.Key := '#if';
328   OptPat.Id:= piDirective;
329   OptPat.Min:= 1;
330   Pat.AddOption(OptPat);
331   TAlphaNumeric.Create(OptPat);
332 {
333   OptPat := TAny.Create(nil);
334   OptPat.Key := '##';
335   OptPat.Id:= piDirective;
336   OptPat.Min:= 1;
337   Pat.AddOption(OptPat);
338   TAlphaNumeric.Create(OptPat);
339 }
340   OptPat := TAny.Create(nil);
341   OptPat.Key := '#';
342   OptPat.Min := 1;
343   OptPat.Id := piSymbol;
344   Pat.AddOption(OptPat);
345   Pat.AddOption(TIdentifier.Create(nil));
346 
347   { KeyWord, Identifier}
348   Pat := TAny.Create(nil);
349   Pat.Key:= 'arrsubset';
350   Pat.Id:= piKeyWord;
351   Pat.Min:= 1;
352   TAlphaNumeric.Create(Pat);
353   Lex.Add(Pat);
354   OptPat := TAny.Create(nil);
355   OptPat.Key := 'arrbuild';
356   OptPat.Id:= piKeyWord;
357   OptPat.Min:= 1;
358   Pat.AddOption(OptPat);
359   TAlphaNumeric.Create(OptPat);
360   OptPat := TAny.Create(nil);
361   OptPat.Key := 'arrtostr';
362   OptPat.Id:= piKeyWord;
363   OptPat.Min:= 1;
364   Pat.AddOption(OptPat);
365   TAlphaNumeric.Create(OptPat);
366   OptPat := TAny.Create(nil);
367   OptPat.Key := 'acquire';
368   OptPat.Id:= piKeyWord;
369   OptPat.Min:= 1;
370   Pat.AddOption(OptPat);
371   TAlphaNumeric.Create(OptPat);
372   OptPat := TAny.Create(nil);
373   OptPat.Key := 'arrinit';
374   OptPat.Id:= piKeyWord;
375   OptPat.Min:= 1;
376   Pat.AddOption(OptPat);
377   TAlphaNumeric.Create(OptPat);
378   OptPat := TAny.Create(nil);
379   OptPat.Key := 'arrsize';
380   OptPat.Id:= piKeyWord;
381   OptPat.Min:= 1;
382   Pat.AddOption(OptPat);
383   TAlphaNumeric.Create(OptPat);
384   OptPat := TAny.Create(nil);
385   OptPat.Key := 'abs';
386   OptPat.Id:= piKeyWord;
387   OptPat.Min:= 1;
388   Pat.AddOption(OptPat);
389   TAlphaNumeric.Create(OptPat);
390   OptPat := TAny.Create(nil);
391   OptPat.Key := 'add';
392   OptPat.Id:= piKeyWord;
393   OptPat.Min:= 1;
394   Pat.AddOption(OptPat);
395   TAlphaNumeric.Create(OptPat);
396   OptPat := TAny.Create(nil);
397   OptPat.Key := 'and';
398   OptPat.Id:= piKeyWord;
399   OptPat.Min:= 1;
400   Pat.AddOption(OptPat);
401   TAlphaNumeric.Create(OptPat);
402   OptPat := TAny.Create(nil);
403   OptPat.Key := 'asl';
404   OptPat.Id:= piKeyWord;
405   OptPat.Min:= 1;
406   Pat.AddOption(OptPat);
407   TAlphaNumeric.Create(OptPat);
408   OptPat := TAny.Create(nil);
409   OptPat.Key := 'asr';
410   OptPat.Id:= piKeyWord;
411   OptPat.Min:= 1;
412   Pat.AddOption(OptPat);
413   TAlphaNumeric.Create(OptPat);
414   Pat.AddOption(TIdentifier.Create(nil));
415 
416   { KeyWord, Identifier}
417   Pat := TAny.Create(nil);
418   Pat.Key:= 'brcmp';
419   Pat.Id:= piKeyWord;
420   Pat.Min:= 1;
421   TAlphaNumeric.Create(Pat);
422   Lex.Add(Pat);
423   OptPat := TAny.Create(nil);
424   OptPat.Key := 'brtst';
425   OptPat.Id:= piKeyWord;
426   OptPat.Min:= 1;
427   Pat.AddOption(OptPat);
428   TAlphaNumeric.Create(OptPat);
429   OptPat := TAny.Create(nil);
430   OptPat.Key := 'byte';
431   OptPat.Id:= piKeyWord;
432   OptPat.Min:= 1;
433   Pat.AddOption(OptPat);
434   TAlphaNumeric.Create(OptPat);
435   Pat.AddOption(TIdentifier.Create(nil));
436 
437   { KeyWord, Identifier}
438   Pat := TAny.Create(nil);
439   Pat.Key:= 'cmpset';
440   Pat.Id:= piKeyWord;
441   Pat.Min:= 1;
442   TAlphaNumeric.Create(Pat);
443   Lex.Add(Pat);
444   OptPat := TAny.Create(nil);
445   OptPat.Key := 'call';
446   OptPat.Id:= piKeyWord;
447   OptPat.Min:= 1;
448   Pat.AddOption(OptPat);
449   TAlphaNumeric.Create(OptPat);
450   OptPat := TAny.Create(nil);
451   OptPat.Key := 'cmnt';
452   OptPat.Id:= piKeyWord;
453   OptPat.Min:= 1;
454   Pat.AddOption(OptPat);
455   TAlphaNumeric.Create(OptPat);
456   OptPat := TAny.Create(nil);
457   OptPat.Key := 'cmp';
458   OptPat.Id:= piKeyWord;
459   OptPat.Min:= 1;
460   Pat.AddOption(OptPat);
461   TAlphaNumeric.Create(OptPat);
462   Pat.AddOption(TIdentifier.Create(nil));
463 
464   { KeyWord, Identifier}
465   Pat := TAny.Create(nil);
466   Pat.Key:= 'dword';
467   Pat.Id:= piKeyWord;
468   Pat.Min:= 1;
469   TAlphaNumeric.Create(Pat);
470   Lex.Add(Pat);
471   OptPat := TAny.Create(nil);
472   OptPat.Key := 'div';
473   OptPat.Id:= piKeyWord;
474   OptPat.Min:= 1;
475   Pat.AddOption(OptPat);
476   TAlphaNumeric.Create(OptPat);
477   OptPat := TAny.Create(nil);
478   OptPat.Key := 'db';
479   OptPat.Id:= piKeyWord;
480   OptPat.Min:= 1;
481   Pat.AddOption(OptPat);
482   TAlphaNumeric.Create(OptPat);
483   OptPat := TAny.Create(nil);
484   OptPat.Key := 'dd';
485   OptPat.Id:= piKeyWord;
486   OptPat.Min:= 1;
487   Pat.AddOption(OptPat);
488   TAlphaNumeric.Create(OptPat);
489   OptPat := TAny.Create(nil);
490   OptPat.Key := 'dw';
491   OptPat.Id:= piKeyWord;
492   OptPat.Min:= 1;
493   Pat.AddOption(OptPat);
494   TAlphaNumeric.Create(OptPat);
495   Pat.AddOption(TIdentifier.Create(nil));
496 
497   { KeyWord, Identifier}
498   Pat := TAny.Create(nil);
499   Pat.Key:= 'exitto';
500   Pat.Id:= piKeyWord;
501   Pat.Min:= 1;
502   TAlphaNumeric.Create(Pat);
503   Lex.Add(Pat);
504   OptPat := TAny.Create(nil);
505   OptPat.Key := 'ends';
506   OptPat.Id:= piKeyWord;
507   OptPat.Min:= 1;
508   Pat.AddOption(OptPat);
509   TAlphaNumeric.Create(OptPat);
510   OptPat := TAny.Create(nil);
511   OptPat.Key := 'endt';
512   OptPat.Id:= piKeyWord;
513   OptPat.Min:= 1;
514   Pat.AddOption(OptPat);
515   TAlphaNumeric.Create(OptPat);
516   OptPat := TAny.Create(nil);
517   OptPat.Key := 'exit';
518   OptPat.Id:= piKeyWord;
519   OptPat.Min:= 1;
520   Pat.AddOption(OptPat);
521   TAlphaNumeric.Create(OptPat);
522   Pat.AddOption(TIdentifier.Create(nil));
523 
524   { KeyWord, Identifier}
525   Pat := TAny.Create(nil);
526   Pat.Key:= 'flatten';
527   Pat.Id:= piKeyWord;
528   Pat.Min:= 1;
529   TAlphaNumeric.Create(Pat);
530   Lex.Add(Pat);
531   OptPat := TAny.Create(nil);
532   OptPat.Key := 'follows';
533   OptPat.Id:= piKeyWord;
534   OptPat.Min:= 1;
535   Pat.AddOption(OptPat);
536   TAlphaNumeric.Create(OptPat);
537   OptPat := TAny.Create(nil);
538   OptPat.Key := 'fmtnum';
539   OptPat.Id:= piKeyWord;
540   OptPat.Min:= 1;
541   Pat.AddOption(OptPat);
542   TAlphaNumeric.Create(OptPat);
543   Pat.AddOption(TIdentifier.Create(nil));
544 
545   { KeyWord, Identifier}
546   Pat := TAny.Create(nil);
547   Pat.Key:= 'gettick';
548   Pat.Id:= piKeyWord;
549   Pat.Min:= 1;
550   TAlphaNumeric.Create(Pat);
551   Lex.Add(Pat);
552   OptPat := TAny.Create(nil);
553   OptPat.Key := 'getout';
554   OptPat.Id:= piKeyWord;
555   OptPat.Min:= 1;
556   Pat.AddOption(OptPat);
557   TAlphaNumeric.Create(OptPat);
558   OptPat := TAny.Create(nil);
559   OptPat.Key := 'getin';
560   OptPat.Id:= piKeyWord;
561   OptPat.Min:= 1;
562   Pat.AddOption(OptPat);
563   TAlphaNumeric.Create(OptPat);
564   Pat.AddOption(TIdentifier.Create(nil));
565 
566   { KeyWord, Identifier}
567   Pat := TAny.Create(nil);
568   Pat.Key:= 'index';
569   Pat.Id:= piKeyWord;
570   Pat.Min:= 1;
571   TAlphaNumeric.Create(Pat);
572   Lex.Add(Pat);
573   Pat.AddOption(TIdentifier.Create(nil));
574 
575   { KeyWord, Identifier}
576   Pat := TAny.Create(nil);
577   Pat.Key:= 'jmp';
578   Pat.Id:= piKeyWord;
579   Pat.Min:= 1;
580   TAlphaNumeric.Create(Pat);
581   Lex.Add(Pat);
582   Pat.AddOption(TIdentifier.Create(nil));
583 
584   { KeyWord, Identifier}
585   Pat := TAny.Create(nil);
586   Pat.Key:= 'long';
587   Pat.Id:= piKeyWord;
588   Pat.Min:= 1;
589   TAlphaNumeric.Create(Pat);
590   Lex.Add(Pat);
591   OptPat := TAny.Create(nil);
592   OptPat.Key := 'lsl';
593   OptPat.Id:= piKeyWord;
594   OptPat.Min:= 1;
595   Pat.AddOption(OptPat);
596   TAlphaNumeric.Create(OptPat);
597   OptPat := TAny.Create(nil);
598   OptPat.Key := 'lsr';
599   OptPat.Id:= piKeyWord;
600   OptPat.Min:= 1;
601   Pat.AddOption(OptPat);
602   TAlphaNumeric.Create(OptPat);
603   Pat.AddOption(TIdentifier.Create(nil));
604 
605   { KeyWord, Identifier}
606   Pat := TAny.Create(nil);
607   Pat.Key:= 'mutex';
608   Pat.Id:= piKeyWord;
609   Pat.Min:= 1;
610   TAlphaNumeric.Create(Pat);
611   Lex.Add(Pat);
612   OptPat := TAny.Create(nil);
613   OptPat.Key := 'mod';
614   OptPat.Id:= piKeyWord;
615   OptPat.Min:= 1;
616   Pat.AddOption(OptPat);
617   TAlphaNumeric.Create(OptPat);
618   OptPat := TAny.Create(nil);
619   OptPat.Key := 'mov';
620   OptPat.Id:= piKeyWord;
621   OptPat.Min:= 1;
622   Pat.AddOption(OptPat);
623   TAlphaNumeric.Create(OptPat);
624   OptPat := TAny.Create(nil);
625   OptPat.Key := 'mul';
626   OptPat.Id:= piKeyWord;
627   OptPat.Min:= 1;
628   Pat.AddOption(OptPat);
629   TAlphaNumeric.Create(OptPat);
630   Pat.AddOption(TIdentifier.Create(nil));
631 
632   { KeyWord, Identifier}
633   Pat := TAny.Create(nil);
634   Pat.Key:= 'numtostr';
635   Pat.Id:= piKeyWord;
636   Pat.Min:= 1;
637   TAlphaNumeric.Create(Pat);
638   Lex.Add(Pat);
639   OptPat := TAny.Create(nil);
640   OptPat.Key := 'neg';
641   OptPat.Id:= piKeyWord;
642   OptPat.Min:= 1;
643   Pat.AddOption(OptPat);
644   TAlphaNumeric.Create(OptPat);
645   OptPat := TAny.Create(nil);
646   OptPat.Key := 'not';
647   OptPat.Id:= piKeyWord;
648   OptPat.Min:= 1;
649   Pat.AddOption(OptPat);
650   TAlphaNumeric.Create(OptPat);
651   Pat.AddOption(TIdentifier.Create(nil));
652 
653   { KeyWord, Identifier}
654   Pat := TAny.Create(nil);
655   Pat.Key:= 'or';
656   Pat.Id:= piKeyWord;
657   Pat.Min:= 1;
658   TAlphaNumeric.Create(Pat);
659   Lex.Add(Pat);
660   Pat.AddOption(TIdentifier.Create(nil));
661 
662   { KeyWord, Identifier}
663   Pat := TAny.Create(nil);
664   Pat.Key:= 'precedes';
665   Pat.Id:= piKeyWord;
666   Pat.Min:= 1;
667   TAlphaNumeric.Create(Pat);
668   Lex.Add(Pat);
669   OptPat := TAny.Create(nil);
670   OptPat.Key := 'priority';
671   OptPat.Id:= piKeyWord;
672   OptPat.Min:= 1;
673   Pat.AddOption(OptPat);
674   TAlphaNumeric.Create(OptPat);
675   Pat.AddOption(TIdentifier.Create(nil));
676 
677   { KeyWord, Identifier}
678   Pat := TAny.Create(nil);
679   Pat.Key:= 'release';
680   Pat.Id:= piKeyWord;
681   Pat.Min:= 1;
682   TAlphaNumeric.Create(Pat);
683   Lex.Add(Pat);
684   OptPat := TAny.Create(nil);
685   OptPat.Key := 'replace';
686   OptPat.Id:= piKeyWord;
687   OptPat.Min:= 1;
688   Pat.AddOption(OptPat);
689   TAlphaNumeric.Create(OptPat);
690   OptPat := TAny.Create(nil);
691   OptPat.Key := 'return';
692   OptPat.Id:= piKeyWord;
693   OptPat.Min:= 1;
694   Pat.AddOption(OptPat);
695   TAlphaNumeric.Create(OptPat);
696   OptPat := TAny.Create(nil);
697   OptPat.Key := 'rotl';
698   OptPat.Id:= piKeyWord;
699   OptPat.Min:= 1;
700   Pat.AddOption(OptPat);
701   TAlphaNumeric.Create(OptPat);
702   OptPat := TAny.Create(nil);
703   OptPat.Key := 'rotr';
704   OptPat.Id:= piKeyWord;
705   OptPat.Min:= 1;
706   Pat.AddOption(OptPat);
707   TAlphaNumeric.Create(OptPat);
708   Pat.AddOption(TIdentifier.Create(nil));
709 
710   { KeyWord, Identifier}
711   Pat := TAny.Create(nil);
712   Pat.Key:= 'stopthread';
713   Pat.Id:= piKeyWord;
714   Pat.Min:= 1;
715   TAlphaNumeric.Create(Pat);
716   Lex.Add(Pat);
717   OptPat := TAny.Create(nil);
718   OptPat.Key := 'subroutine';
719   OptPat.Id:= piKeyWord;
720   OptPat.Min:= 1;
721   Pat.AddOption(OptPat);
722   TAlphaNumeric.Create(OptPat);
723   OptPat := TAny.Create(nil);
724   OptPat.Key := 'strsubset';
725   OptPat.Id:= piKeyWord;
726   OptPat.Min:= 1;
727   Pat.AddOption(OptPat);
728   TAlphaNumeric.Create(OptPat);
729   OptPat := TAny.Create(nil);
730   OptPat.Key := 'strtoarr';
731   OptPat.Id:= piKeyWord;
732   OptPat.Min:= 1;
733   Pat.AddOption(OptPat);
734   TAlphaNumeric.Create(OptPat);
735   OptPat := TAny.Create(nil);
736   OptPat.Key := 'strtonum';
737   OptPat.Id:= piKeyWord;
738   OptPat.Min:= 1;
739   Pat.AddOption(OptPat);
740   TAlphaNumeric.Create(OptPat);
741   OptPat := TAny.Create(nil);
742   OptPat.Key := 'segment';
743   OptPat.Id:= piKeyWord;
744   OptPat.Min:= 1;
745   Pat.AddOption(OptPat);
746   TAlphaNumeric.Create(OptPat);
747   OptPat := TAny.Create(nil);
748   OptPat.Key := 'subcall';
749   OptPat.Id:= piKeyWord;
750   OptPat.Min:= 1;
751   Pat.AddOption(OptPat);
752   TAlphaNumeric.Create(OptPat);
753   OptPat := TAny.Create(nil);
754   OptPat.Key := 'syscall';
755   OptPat.Id:= piKeyWord;
756   OptPat.Min:= 1;
757   Pat.AddOption(OptPat);
758   TAlphaNumeric.Create(OptPat);
759   OptPat := TAny.Create(nil);
760   OptPat.Key := 'sdword';
761   OptPat.Id:= piKeyWord;
762   OptPat.Min:= 1;
763   Pat.AddOption(OptPat);
764   TAlphaNumeric.Create(OptPat);
765   OptPat := TAny.Create(nil);
766   OptPat.Key := 'setout';
767   OptPat.Id:= piKeyWord;
768   OptPat.Min:= 1;
769   Pat.AddOption(OptPat);
770   TAlphaNumeric.Create(OptPat);
771   OptPat := TAny.Create(nil);
772   OptPat.Key := 'strcat';
773   OptPat.Id:= piKeyWord;
774   OptPat.Min:= 1;
775   Pat.AddOption(OptPat);
776   TAlphaNumeric.Create(OptPat);
777   OptPat := TAny.Create(nil);
778   OptPat.Key := 'struct';
779   OptPat.Id:= piKeyWord;
780   OptPat.Min:= 1;
781   Pat.AddOption(OptPat);
782   TAlphaNumeric.Create(OptPat);
783   OptPat := TAny.Create(nil);
784   OptPat.Key := 'subret';
785   OptPat.Id:= piKeyWord;
786   OptPat.Min:= 1;
787   Pat.AddOption(OptPat);
788   TAlphaNumeric.Create(OptPat);
789   OptPat := TAny.Create(nil);
790   OptPat.Key := 'sbyte';
791   OptPat.Id:= piKeyWord;
792   OptPat.Min:= 1;
793   Pat.AddOption(OptPat);
794   TAlphaNumeric.Create(OptPat);
795   OptPat := TAny.Create(nil);
796   OptPat.Key := 'setin';
797   OptPat.Id:= piKeyWord;
798   OptPat.Min:= 1;
799   Pat.AddOption(OptPat);
800   TAlphaNumeric.Create(OptPat);
801   OptPat := TAny.Create(nil);
802   OptPat.Key := 'slong';
803   OptPat.Id:= piKeyWord;
804   OptPat.Min:= 1;
805   Pat.AddOption(OptPat);
806   TAlphaNumeric.Create(OptPat);
807   OptPat := TAny.Create(nil);
808   OptPat.Key := 'start';
809   OptPat.Id:= piKeyWord;
810   OptPat.Min:= 1;
811   Pat.AddOption(OptPat);
812   TAlphaNumeric.Create(OptPat);
813   OptPat := TAny.Create(nil);
814   OptPat.Key := 'sword';
815   OptPat.Id:= piKeyWord;
816   OptPat.Min:= 1;
817   Pat.AddOption(OptPat);
818   TAlphaNumeric.Create(OptPat);
819   OptPat := TAny.Create(nil);
820   OptPat.Key := 'sign';
821   OptPat.Id:= piKeyWord;
822   OptPat.Min:= 1;
823   Pat.AddOption(OptPat);
824   TAlphaNumeric.Create(OptPat);
825   OptPat := TAny.Create(nil);
826   OptPat.Key := 'stop';
827   OptPat.Id:= piKeyWord;
828   OptPat.Min:= 1;
829   Pat.AddOption(OptPat);
830   TAlphaNumeric.Create(OptPat);
831   OptPat := TAny.Create(nil);
832   OptPat.Key := 'set';
833   OptPat.Id:= piKeyWord;
834   OptPat.Min:= 1;
835   Pat.AddOption(OptPat);
836   TAlphaNumeric.Create(OptPat);
837   OptPat := TAny.Create(nil);
838   OptPat.Key := 'sub';
839   OptPat.Id:= piKeyWord;
840   OptPat.Min:= 1;
841   Pat.AddOption(OptPat);
842   TAlphaNumeric.Create(OptPat);
843   Pat.AddOption(TIdentifier.Create(nil));
844 
845   { KeyWord, Identifier}
846   Pat := TAny.Create(nil);
847   Pat.Key:= 'typedef';
848   Pat.Id:= piKeyWord;
849   Pat.Min:= 1;
850   TAlphaNumeric.Create(Pat);
851   Lex.Add(Pat);
852   OptPat := TAny.Create(nil);
853   OptPat.Key := 'thread';
854   OptPat.Id:= piKeyWord;
855   OptPat.Min:= 1;
856   Pat.AddOption(OptPat);
857   TAlphaNumeric.Create(OptPat);
858   OptPat := TAny.Create(nil);
859   OptPat.Key := 'tstset';
860   OptPat.Id:= piKeyWord;
861   OptPat.Min:= 1;
862   Pat.AddOption(OptPat);
863   TAlphaNumeric.Create(OptPat);
864   OptPat := TAny.Create(nil);
865   OptPat.Key := 'tst';
866   OptPat.Id:= piKeyWord;
867   OptPat.Min:= 1;
868   Pat.AddOption(OptPat);
869   TAlphaNumeric.Create(OptPat);
870   Pat.AddOption(TIdentifier.Create(nil));
871 
872   { KeyWord, Identifier}
873   Pat := TAny.Create(nil);
874   Pat.Key:= 'unflatten';
875   Pat.Id:= piKeyWord;
876   Pat.Min:= 1;
877   TAlphaNumeric.Create(Pat);
878   Lex.Add(Pat);
879   OptPat := TAny.Create(nil);
880   OptPat.Key := 'udword';
881   OptPat.Id:= piKeyWord;
882   OptPat.Min:= 1;
883   Pat.AddOption(OptPat);
884   TAlphaNumeric.Create(OptPat);
885   OptPat := TAny.Create(nil);
886   OptPat.Key := 'ubyte';
887   OptPat.Id:= piKeyWord;
888   OptPat.Min:= 1;
889   Pat.AddOption(OptPat);
890   TAlphaNumeric.Create(OptPat);
891   OptPat := TAny.Create(nil);
892   OptPat.Key := 'ulong';
893   OptPat.Id:= piKeyWord;
894   OptPat.Min:= 1;
895   Pat.AddOption(OptPat);
896   TAlphaNumeric.Create(OptPat);
897   OptPat := TAny.Create(nil);
898   OptPat.Key := 'uword';
899   OptPat.Id:= piKeyWord;
900   OptPat.Min:= 1;
901   Pat.AddOption(OptPat);
902   TAlphaNumeric.Create(OptPat);
903   Pat.AddOption(TIdentifier.Create(nil));
904 
905   { KeyWord, Identifier}
906   Pat := TAny.Create(nil);
907   Pat.Key:= 'void';
908   Pat.Id:= piKeyWord;
909   Pat.Min:= 1;
910   TAlphaNumeric.Create(Pat);
911   Lex.Add(Pat);
912   Pat.AddOption(TIdentifier.Create(nil));
913 
914   { KeyWord, Identifier}
915   Pat := TAny.Create(nil);
916   Pat.Key:= 'waitv';
917   Pat.Id:= piKeyWord;
918   Pat.Min:= 1;
919   TAlphaNumeric.Create(Pat);
920   Lex.Add(Pat);
921   OptPat := TAny.Create(nil);
922   OptPat.Key := 'wait';
923   OptPat.Id:= piKeyWord;
924   OptPat.Min:= 1;
925   Pat.AddOption(OptPat);
926   TAlphaNumeric.Create(OptPat);
927   OptPat := TAny.Create(nil);
928   OptPat.Key := 'word';
929   OptPat.Id:= piKeyWord;
930   OptPat.Min:= 1;
931   Pat.AddOption(OptPat);
932   TAlphaNumeric.Create(OptPat);
933   Pat.AddOption(TIdentifier.Create(nil));
934 
935   { KeyWord, Identifier}
936   Pat := TAny.Create(nil);
937   Pat.Key:= 'xor';
938   Pat.Id:= piKeyWord;
939   Pat.Min:= 1;
940   TAlphaNumeric.Create(Pat);
941   Lex.Add(Pat);
942   Pat.AddOption(TIdentifier.Create(nil));
943 
944 end;
945 
946 end.
947