feat: add line comment support to lexer with skipLineComment helper

Add a new `skipLineComment` function to the compiler's lexer that consumes
characters from the current position until a newline or end-of-file is
encountered. Update the `readRawToken` switch case for '/' to detect the
"//" sequence and delegate to the new function instead of emitting a
TOKEN_SLASH. Also add a line comment to the example hello.wren file to
demonstrate the feature.
This commit is contained in:
Bob Nystrom
2013-10-26 03:07:04 +00:00
parent 406826a980
commit f1bade2c81
2 changed files with 19 additions and 2 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
class Foo {
class Foo { // line comment
bar {
123
}