|
@@ -35,30 +35,47 @@ static const struct idf ppcmd[] = {
|
|
static const struct idf reserved[] = {
|
|
static const struct idf reserved[] = {
|
|
{"and", NORM('&')},
|
|
{"and", NORM('&')},
|
|
{"array", NORM('A')},
|
|
{"array", NORM('A')},
|
|
|
|
+ {"as", NORM('a')},
|
|
{"begin", NORM('{')},
|
|
{"begin", NORM('{')},
|
|
{"case", NORM('c')},
|
|
{"case", NORM('c')},
|
|
|
|
+ {"catch", META('C')},
|
|
|
|
+ {"class", META('c')},
|
|
|
|
+ {"continue", CTRL('C')},
|
|
|
|
+ {"constructor", NORM('p')}, /* equal to procedure */
|
|
{"const", NORM('C')},
|
|
{"const", NORM('C')},
|
|
|
|
+ {"destructor", NORM('p')}, /* equal to procedure */
|
|
{"div", NORM('/')},
|
|
{"div", NORM('/')},
|
|
{"do", NORM('D')},
|
|
{"do", NORM('D')},
|
|
{"downto", NORM('d')},
|
|
{"downto", NORM('d')},
|
|
{"else", NORM('e')},
|
|
{"else", NORM('e')},
|
|
{"end", NORM('}')},
|
|
{"end", NORM('}')},
|
|
{"extern", CTRL('E')},
|
|
{"extern", CTRL('E')},
|
|
|
|
+ {"except", META('E')},
|
|
{"file", NORM('F')},
|
|
{"file", NORM('F')},
|
|
|
|
+ {"finally", META('F')},
|
|
{"for", NORM('f')},
|
|
{"for", NORM('f')},
|
|
{"function", NORM('p')}, /* Equal to procedure */
|
|
{"function", NORM('p')}, /* Equal to procedure */
|
|
{"goto", NORM('g')},
|
|
{"goto", NORM('g')},
|
|
{"if", NORM('i')},
|
|
{"if", NORM('i')},
|
|
{"in", NORM('I')},
|
|
{"in", NORM('I')},
|
|
|
|
+ {"inherited", META('i')},
|
|
|
|
+ {"is", META('I')},
|
|
{"label", NORM('l')},
|
|
{"label", NORM('l')},
|
|
{"mod", NORM('%')},
|
|
{"mod", NORM('%')},
|
|
{"nil", NORM('n')},
|
|
{"nil", NORM('n')},
|
|
{"not", NORM('!')},
|
|
{"not", NORM('!')},
|
|
{"of", SKIP},
|
|
{"of", SKIP},
|
|
|
|
+ {"on", SKIP},
|
|
{"or", NORM('|')},
|
|
{"or", NORM('|')},
|
|
|
|
+ {"object", NORM('O')},
|
|
|
|
+ {"override", NORM('o')},
|
|
{"packed", NORM('P')},
|
|
{"packed", NORM('P')},
|
|
{"procedure", NORM('p')},
|
|
{"procedure", NORM('p')},
|
|
{"program", SKIP},
|
|
{"program", SKIP},
|
|
|
|
+ {"private", META('P')},
|
|
|
|
+ {"protected", META('p')},
|
|
|
|
+ {"public", CTRL('P')},
|
|
|
|
+ {"raise", META('R')},
|
|
{"record", NORM('r')},
|
|
{"record", NORM('r')},
|
|
{"repeat", NORM('R')},
|
|
{"repeat", NORM('R')},
|
|
{"set", NORM('s')},
|
|
{"set", NORM('s')},
|
|
@@ -67,6 +84,7 @@ static const struct idf reserved[] = {
|
|
{"type", NORM('T')},
|
|
{"type", NORM('T')},
|
|
{"until", NORM('u')},
|
|
{"until", NORM('u')},
|
|
{"var", NORM('v')},
|
|
{"var", NORM('v')},
|
|
|
|
+ {"virtual", NORM('V')},
|
|
{"while", NORM('w')},
|
|
{"while", NORM('w')},
|
|
{"with", NORM('W')}
|
|
{"with", NORM('W')}
|
|
};
|
|
};
|
|
@@ -108,6 +126,8 @@ const TOKEN NonFinals[] = {
|
|
NORM('['),
|
|
NORM('['),
|
|
NORM('A'), /* array */
|
|
NORM('A'), /* array */
|
|
NORM('c'), /* case */
|
|
NORM('c'), /* case */
|
|
|
|
+ META('C'), /* catch */
|
|
|
|
+ META('c'), /* class */
|
|
NORM('C'), /* const */
|
|
NORM('C'), /* const */
|
|
NORM('/'), /* div */
|
|
NORM('/'), /* div */
|
|
CTRL('E'), /* extern */
|
|
CTRL('E'), /* extern */
|
|
@@ -115,9 +135,15 @@ const TOKEN NonFinals[] = {
|
|
NORM('f'), /* for */
|
|
NORM('f'), /* for */
|
|
NORM('g'), /* goto */
|
|
NORM('g'), /* goto */
|
|
NORM('i'), /* if */
|
|
NORM('i'), /* if */
|
|
|
|
+ META('i'), /* inherited */
|
|
NORM('l'), /* label */
|
|
NORM('l'), /* label */
|
|
|
|
+ NORM('O'), /* object */
|
|
NORM('P'), /* packed */
|
|
NORM('P'), /* packed */
|
|
- NORM('p'), /* procedure/function */
|
|
|
|
|
|
+ NORM('p'), /* procedure/function/constructor/destructor */
|
|
|
|
+ META('P'), /* private */
|
|
|
|
+ META('p'), /* protected */
|
|
|
|
+ CTRL('p'), /* public */
|
|
|
|
+ META('R'), /* raise */
|
|
NORM('r'), /* record */
|
|
NORM('r'), /* record */
|
|
NORM('R'), /* repeat */
|
|
NORM('R'), /* repeat */
|
|
NORM('s'), /* set */
|
|
NORM('s'), /* set */
|
|
@@ -164,6 +190,8 @@ EndComment ("}"|"*)")
|
|
SafeComChar ([^*}\n])
|
|
SafeComChar ([^*}\n])
|
|
UnsafeComChar ("*")
|
|
UnsafeComChar ("*")
|
|
|
|
|
|
|
|
+SingleLineCom ("//".*)
|
|
|
|
+
|
|
Digit ([0-9])
|
|
Digit ([0-9])
|
|
Idf ([A-Za-z][A-Za-z0-9_]*)
|
|
Idf ([A-Za-z][A-Za-z0-9_]*)
|
|
|
|
|
|
@@ -191,6 +219,10 @@ Idf ([A-Za-z][A-Za-z0-9_]*)
|
|
return_ch('"');
|
|
return_ch('"');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+{SingleLineCom}"\n" { /* single-line comment */
|
|
|
|
+ return_eol();
|
|
|
|
+ }
|
|
|
|
+
|
|
^#{Layout}*include.* { /* ignore #include lines */
|
|
^#{Layout}*include.* { /* ignore #include lines */
|
|
}
|
|
}
|
|
|
|
|