1 | ; SILex - Scheme Implementation of Lex |
---|
2 | ; Copyright (C) 2001 Danny Dube' |
---|
3 | |
---|
4 | space " " |
---|
5 | tab " " |
---|
6 | comment ";".* |
---|
7 | hblank {space}|{tab}|{comment} |
---|
8 | vblank "\n" |
---|
9 | |
---|
10 | digit [0123456789] |
---|
11 | letter [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ] |
---|
12 | specini "!"|"$"|"%"|"&"|"*"|"/"|":"|"<"|"="|">"|"?"|"~"|"_"|"^" |
---|
13 | specsub "."|"+"|"-" |
---|
14 | initial {letter}|{specini} |
---|
15 | subseq {letter}|{digit}|{specini}|{specsub} |
---|
16 | peculid "+"|"-"|"..." |
---|
17 | id {initial}{subseq}*|{peculid} |
---|
18 | |
---|
19 | %% |
---|
20 | |
---|
21 | {hblank} (make-tok hblank-tok yytext yyline) |
---|
22 | {vblank} (make-tok vblank-tok yytext yyline) |
---|
23 | "|" (make-tok pipe-tok yytext yyline) |
---|
24 | "?" (make-tok question-tok yytext yyline) |
---|
25 | "+" (make-tok plus-tok yytext yyline) |
---|
26 | "*" (make-tok star-tok yytext yyline) |
---|
27 | "(" (make-tok lpar-tok yytext yyline) |
---|
28 | ")" (make-tok rpar-tok yytext yyline) |
---|
29 | "." (make-tok dot-tok yytext yyline) |
---|
30 | "[" (make-tok lbrack-tok yytext yyline) |
---|
31 | "[]" (make-tok lbrack-rbrack-tok yytext yyline) |
---|
32 | "[^" (make-tok lbrack-caret-tok yytext yyline) |
---|
33 | "[-" (make-tok lbrack-minus-tok yytext yyline) |
---|
34 | "{"{id}"}" (parse-id-ref yytext yyline) |
---|
35 | "{"{digit}+"}" (parse-power-m yytext yyline) |
---|
36 | "{"{digit}+",}" (parse-power-m-inf yytext yyline) |
---|
37 | "{"{digit}+","{digit}+"}" (parse-power-m-n yytext yyline) |
---|
38 | "{" (make-tok illegal-tok yytext yyline) |
---|
39 | "\"" (make-tok doublequote-tok yytext yyline) |
---|
40 | "\\n" (parse-spec-char yytext yyline) |
---|
41 | "\\"{digit}+ (parse-digits-char yytext yyline) |
---|
42 | "\\-"{digit}+ (parse-digits-char yytext yyline) |
---|
43 | "\\"[^] (parse-quoted-char yytext yyline) |
---|
44 | "^" (make-tok caret-tok yytext yyline) |
---|
45 | "$" (make-tok dollar-tok yytext yyline) |
---|
46 | . (parse-ordinary-char yytext yyline) |
---|
47 | "<<EOF>>" (make-tok <<EOF>>-tok yytext yyline) |
---|
48 | "<<ERROR>>" (make-tok <<ERROR>>-tok yytext yyline) |
---|
49 | <<EOF>> (make-tok eof-tok yytext yyline) |
---|