repositories
/
TP_AL_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix the sub section detector.
[TP_AL_C.git]
/
lexer
/
main.c
diff --git
a/lexer/main.c
b/lexer/main.c
index 671d88f94286139bee7cd87159b149312c0e92c2..3247e34c93d17bf8f2879b120b62a94941b7501e 100644
(file)
--- a/
lexer/main.c
+++ b/
lexer/main.c
@@
-17,6
+17,7
@@
enum TokenType {
} tokenType;
const char* tokenTypestr[] = { "MOTCLE", "SECTION", "SSECTION", "NPARA", "MOT", "FIN" };
} tokenType;
const char* tokenTypestr[] = { "MOTCLE", "SECTION", "SSECTION", "NPARA", "MOT", "FIN" };
+/* This looks silly to check for each characters but for debugging, it's just the way to go */
bool istAlpha() {
if (c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f' || c == 'g' || \
c == 'h' || c == 'i' || c == 'j' || c == 'k' || c == 'l' || c == 'm' || c == 'n' || \
bool istAlpha() {
if (c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f' || c == 'g' || \
c == 'h' || c == 'i' || c == 'j' || c == 'k' || c == 'l' || c == 'm' || c == 'n' || \
@@
-107,25
+108,30
@@
MC1:
}
S1SS1:
}
S1SS1:
- if (isSeparator() || c == EOF) {
- goto SECTION;
- }
if (c == '=') {
c = fgetc(source);
tokenValue[i] = c;
i++;
goto SS2;
}
if (c == '=') {
c = fgetc(source);
tokenValue[i] = c;
i++;
goto SS2;
}
+ if (isSeparator() || c == EOF) {
+ goto SECTION;
+ }
+
SS2:
if (isSeparator() || c == EOF) {
SS2:
if (isSeparator() || c == EOF) {
- goto SECTION;
+ goto S
S
ECTION;
}
SECTION:
tokenType = SECTION;
return 1;
}
SECTION:
tokenType = SECTION;
return 1;
+SSECTION:
+ tokenType = SSECTION;
+ return 1;
+
M1:
if (istAlpha()) {
c = fgetc(source);
M1:
if (istAlpha()) {
c = fgetc(source);
@@
-191,12
+197,12
@@
initLV1LV2:
i++;
goto S1SS1;
}
i++;
goto S1SS1;
}
- if (c == EOF) {
- goto FIN;
- }
if (istAlpha()) {
goto NPARA;
}
if (istAlpha()) {
goto NPARA;
}
+ if (c == EOF) {
+ goto FIN;
+ }
NPARA:
tokenType = NPARA;
NPARA:
tokenType = NPARA;