aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorMatt Brubeck <[email protected]>2010-07-08 17:01:25 +0800
committerGraydon Hoare <[email protected]>2010-07-08 22:43:15 +0800
commit244ea680820c205461ad5af979c0a722372e6dc6 (patch)
tree45d4da70ea8f68b84105bfdac48f8556519fb14e /src/boot
parentSome more typestate tests. (diff)
downloadrust-244ea680820c205461ad5af979c0a722372e6dc6.tar.xz
rust-244ea680820c205461ad5af979c0a722372e6dc6.zip
Issue 66: Multi-line comments
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/fe/lexer.mll15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/boot/fe/lexer.mll b/src/boot/fe/lexer.mll
index 6430821d..090da25f 100644
--- a/src/boot/fe/lexer.mll
+++ b/src/boot/fe/lexer.mll
@@ -139,7 +139,7 @@ rule token = parse
<- (bump_line lexbuf.Lexing.lex_curr_p);
token lexbuf }
| "//" [^'\n']* { token lexbuf }
-
+| "/*" { comment 1 lexbuf }
| '+' { PLUS }
| '-' { MINUS }
| '*' { STAR }
@@ -362,3 +362,16 @@ and bracequote buf depth = parse
| [^'\\' '{' '}']+ { let s = Lexing.lexeme lexbuf in
Buffer.add_string buf s;
bracequote buf depth lexbuf }
+
+
+and comment depth = parse
+
+ '/' '*' { comment (depth+1) lexbuf }
+
+| '*' '/' { if depth = 1
+ then token lexbuf
+ else comment (depth-1) lexbuf }
+
+| '*' [^'{'] { comment depth lexbuf }
+| '/' [^'*'] { comment depth lexbuf }
+| [^'/' '*']+ { comment depth lexbuf }