Fixed tokenization
This commit is contained in:
@@ -22,7 +22,7 @@ set type text/html
|
|||||||
# The following pages are html
|
# The following pages are html
|
||||||
read / site/index.html
|
read / site/index.html
|
||||||
# The path / should be read from site/index.html
|
# The path / should be read from site/index.html
|
||||||
read /hello site/hello.html
|
read /hello site/hello.html
|
||||||
# The path /hello should be read from site/hello.html
|
# The path /hello should be read from site/hello.html
|
||||||
|
|
||||||
throw /blog/forbidden 403
|
throw /blog/forbidden 403
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ static void gettoken(FILE *file, Token *ret) {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
c = fgetc(file);
|
c = fgetc(file);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case '#':
|
||||||
|
while (c != '\n' && c != EOF)
|
||||||
|
c = fgetc(file);
|
||||||
case '\n':
|
case '\n':
|
||||||
ret->type = LINE_END;
|
ret->type = LINE_END;
|
||||||
return;
|
return;
|
||||||
@@ -125,7 +128,12 @@ static CommandType getcommand(FILE *file, int *argcret, char ***argvret) {
|
|||||||
case FILE_END:
|
case FILE_END:
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return PAST_END;
|
return PAST_END;
|
||||||
|
goto gotcommand;
|
||||||
case LINE_END:
|
case LINE_END:
|
||||||
|
if (argc == 0)
|
||||||
|
return getcommand(file, argcret, argvret);
|
||||||
|
goto gotcommand;
|
||||||
|
gotcommand:
|
||||||
*argcret = argc;
|
*argcret = argc;
|
||||||
*argvret = argv;
|
*argvret = argv;
|
||||||
return NORMAL;
|
return NORMAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user