添加单行注释功能
This commit is contained in:
parent
f5a4fe139a
commit
c921a9f9cd
@ -52,6 +52,13 @@ vector<Token> scan(string s) {
|
||||
} else {
|
||||
printf("error on line %d", line), exit(1);
|
||||
}
|
||||
} else if (s[pt] == '/') {
|
||||
if (pt + 1 < s.size() && s[pt + 1] == '/') {
|
||||
for (pt += 2; pt < s.size() && s[pt] != '\n'; pt++) {}
|
||||
continue;
|
||||
} else {
|
||||
printf("error on line %d", line), exit(1);
|
||||
}
|
||||
} else if (isalpha(s[pt]) || s[pt] == '_') {
|
||||
size_t r = pt + 1;
|
||||
while (r < s.size() && (isalpha(s[r]) || s[r] == '_' || isdigit(s[r]))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user