diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-16 17:05:12 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-16 17:05:12 +0100 |
commit | f20d043f9d9ace0ed6cd1359c8308c0eb39e0919 (patch) | |
tree | 633b0a91780415e2cf9898e58c9cdf44d2a62e40 /src/lexer.mll | |
parent | ec7d5bcc03e4bad22b6cc790aa69cb310ec452e4 (diff) | |
download | LPC-Projet-f20d043f9d9ace0ed6cd1359c8308c0eb39e0919.tar.gz LPC-Projet-f20d043f9d9ace0ed6cd1359c8308c0eb39e0919.zip |
Finished parser (all tests pass!)
Diffstat (limited to 'src/lexer.mll')
-rw-r--r-- | src/lexer.mll | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lexer.mll b/src/lexer.mll index 763bd37..19af488 100644 --- a/src/lexer.mll +++ b/src/lexer.mll @@ -54,8 +54,9 @@ rule token = parse | ident as id { id_or_kwd id } | "//" { short_comment lexbuf; token lexbuf } | "/*" { long_comment lexbuf; token lexbuf } - | "#include <iostream>" { INCLUDE_IOSTREAM } - | "std::cout" { STD_COUT } + | "#include <iostream>" { INCLUDE_IOSTREAM } (* nasty hack #1 *) + | "std::cout" { STD_COUT } (* nasty hack #2 *) + | "std::endl" { STRVAL("\n") } (* nasty hack #3 *) | "0x" (hexa+ as n) { INTVAL(int_of_string("0x" ^ n)) } | ['1'-'9'] digit* as n { INTVAL(int_of_string(n)) } | '0' (octal+ as n) { INTVAL(int_of_string("0o" ^ n)) } |