| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- -- Now TEX scaner is available.
- -- T+ defines LaTeX lexical rules
- -- and value of new "tex_lexics" boolean variable
- -- @+ defines (additionaly to T+) .sty - file mode of LaTeX,
- -- when @ characters are allowed in command names
- -- .TEX file have to be with 'P-U-p-A-T+'
- -- .STY file have to be with 'P-U-p-A-T+@+'
- #E
- OPEN S 'S2.LST';
- $L:=#CALL_PAS(35 'sample.TEX' 'P-U-p-A-T+');
- PRINT $L;
- $L:= #CONV($L);
- PRINT $L;
- #STAT($L);
- #CALL_PAS(1);
- FORALL $E IN $L DO S<]@$E; IF NOT $E->S<<;S<<;FI;OD;
- ##
- #CONV
- (. (* ( ( '%' (* S'($$) *) NULL ) -- removes all comments
- ! ( $X!.:=' ' (* ' ' *) ) -- removes all spaces but one
- ! ( NULL (+ NULL +) / $X!.:=NULL / ) -- leave one NULL if many
- ! ( NULL / $X!. :=' '/) -- removes single NULLs,
- -- changing them to spaces
- ! $X!.:=$E
- )
- *)
- .)
- /RETURN $X/
- ##
- #STAT
- (. (* ( $IDENT!.:=#IDENT
- ! $KEYS!.:=#_KEYWORD
- ! $NULLS!.:=NULL
- ! $ATOMS!.:=$ANY
- )
- *)
- .)
- /
- PRINT (. IDENTIFIERS $IDENT .);
- PRINT (. KEYWORDs $KEYS .);
- PRINT (. NULLs $NULLS .);
- PRINT (. OTHER GOOD THINGS $ATOMS .);
- /
- ##
|