ps2: remove comments from scanner.l
This commit is contained in:
+11
-29
@@ -23,35 +23,17 @@ BINDING ^[a-zA-Z]+[a-zA-Z0-9_]*$
|
||||
{WHITESPACE}+ { /* Eliminate whitespace */ }
|
||||
{QUOTED} { return STRING_TOKEN; }
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
*
|
||||
* Add the rest of the translation rules here.
|
||||
* See the lexical structure definition of the modified VSL in PS2.
|
||||
* Also see the `%token` directives in parser.y for all symbolic names that can be returned - e.g. FUNC, IF, IDENTIFIER_TOKEN.
|
||||
*
|
||||
* Hint to get you started:
|
||||
* The WHITESPACE regex defined above is not quite finished. Finish it.
|
||||
* The scanner returns STRING_TOKEN when matching the QUOTED regex above.
|
||||
* When should the scanner return a NUMBER_TOKEN, IDENTIFIER_TOKEN, etc?
|
||||
* In which specific scenarios should the scanner return keyword tokens like FUNC or PRINT?
|
||||
*
|
||||
* For operators, which are all a single char or two chars, we let each char be a separate token.
|
||||
* This is achieved by using the "catch-all" rule at the very bottom of this file.
|
||||
*/
|
||||
|
||||
/* All other chars get returned as single char tokens */
|
||||
{func} { return FUNC; }
|
||||
{var} { return VAR; }
|
||||
{return} { return RETURN; }
|
||||
{print} { return PRINT; }
|
||||
{println} { return PRINTLN; }
|
||||
{if} { return IF; }
|
||||
{else} { return ELSE; }
|
||||
{while} { return WHILE; }
|
||||
{break} { return BREAK; }
|
||||
{and} { return AND; }
|
||||
{or} { return OR; }
|
||||
func { return FUNC; }
|
||||
var { return VAR; }
|
||||
return { return RETURN; }
|
||||
print { return PRINT; }
|
||||
println { return PRINTLN; }
|
||||
if { return IF; }
|
||||
else { return ELSE; }
|
||||
while { return WHILE; }
|
||||
break { return BREAK; }
|
||||
and { return AND; }
|
||||
or { return OR; }
|
||||
{NUMERIC} { return NUMBER_TOKEN; }
|
||||
{BINDING} { return IDENTIFIER_TOKEN; }
|
||||
. { return yytext[0]; }
|
||||
|
||||
Reference in New Issue
Block a user