Website Summary Files Commits Branches @commit @diff @stats
path: root / spasm / src / asm / lexer.re
diff options
context:
space:
mode:
1 files changed, 18 insertions, 2 deletions
-rw-r--r--spasm/src/asm/lexer.re20
diff --git a/spasm/src/asm/lexer.re b/spasm/src/asm/lexer.re
index fabeaf7..bdf792d 100644
--- a/spasm/src/asm/lexer.re
+++ b/spasm/src/asm/lexer.re
@@ -56,6 +56,8 @@ NONNEGATIVE = "0" | ([1-9] DIGIT*) ;
XINTEGER = "0" [xX] XDIGIT+ ;
FLOATING = "-"? "0" | ([1-9] DIGIT*) "." NONNEGATIVE ;
IDENTIFIER = [a-zA-Z_] [0-9a-zA-Z_]* ;
+SSTRING = "'" ([^']|"\\'")* "'" ;
+DSTRING = "\"" ([^"]|"\\\"")* "\"" ;
INTEGER {
ts.push_token (Token (Token::Integer, lineno,
@@ -198,13 +200,20 @@ XINTEGER {
token_start = cursor;
continue;
- }
+ }
"const" {
ts.push_token (Token (Token::Const, lineno));
token_start = cursor;
continue;
- }
+ }
+
+"string" {
+ ts.push_token (Token (Token::String, lineno));
+ token_start = cursor;
+
+ continue;
+ }
"call" {
ts.push_token (Token (Token::Call, lineno));
@@ -247,6 +256,13 @@ IDENTIFIER {
continue;
}
+SSTRING | DSTRING {
+ ts.push_token (Token (Token::StringValue, lineno, token_start + 1,
+ cursor - 1));
+ token_start = cursor;
+
+ continue;
+ }
[ ]+ {
token_start = cursor;