aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-11-20 16:08:01 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-11-21 20:43:41 -0500
commitfd6020c4e26c5a1e3652c2f88ab4e668f6fc1dbc (patch)
treeb355a679245752973edda218201550def88aa58d /lib
parentcf2fe2536e65e7d0d8892f630282f3d264454cc3 (diff)
downloadzig-fd6020c4e26c5a1e3652c2f88ab4e668f6fc1dbc.tar.gz
zig-fd6020c4e26c5a1e3652c2f88ab4e668f6fc1dbc.zip
update tests, better error messages, update self-hosted tokenizer
Diffstat (limited to 'lib')
-rw-r--r--lib/std/zig/parser_test.zig6
-rw-r--r--lib/std/zig/tokenizer.zig22
2 files changed, 1 insertions, 27 deletions
diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig
index 0f9d0a59cf..ebe396e145 100644
--- a/lib/std/zig/parser_test.zig
+++ b/lib/std/zig/parser_test.zig
@@ -1725,11 +1725,6 @@ test "zig fmt: multiline string" {
\\ \\two)
\\ \\three
\\ ;
- \\ const s2 =
- \\ c\\one
- \\ c\\two)
- \\ c\\three
- \\ ;
\\ const s3 = // hi
\\ \\one
\\ \\two)
@@ -1746,7 +1741,6 @@ test "zig fmt: values" {
\\ 1;
\\ 1.0;
\\ "string";
- \\ c"cstring";
\\ 'c';
\\ true;
\\ false;
diff --git a/lib/std/zig/tokenizer.zig b/lib/std/zig/tokenizer.zig
index f17adae648..2e89669e2c 100644
--- a/lib/std/zig/tokenizer.zig
+++ b/lib/std/zig/tokenizer.zig
@@ -351,7 +351,6 @@ pub const Tokenizer = struct {
Start,
Identifier,
Builtin,
- C,
StringLiteral,
StringLiteralBackslash,
MultilineStringLiteralLine,
@@ -427,10 +426,6 @@ pub const Tokenizer = struct {
' ', '\n', '\t', '\r' => {
result.start = self.index + 1;
},
- 'c' => {
- state = State.C;
- result.id = Token.Id.Identifier;
- },
'"' => {
state = State.StringLiteral;
result.id = Token.Id.StringLiteral;
@@ -438,7 +433,7 @@ pub const Tokenizer = struct {
'\'' => {
state = State.CharLiteral;
},
- 'a'...'b', 'd'...'z', 'A'...'Z', '_' => {
+ 'a'...'z', 'A'...'Z', '_' => {
state = State.Identifier;
result.id = Token.Id.Identifier;
},
@@ -730,20 +725,6 @@ pub const Tokenizer = struct {
},
else => break,
},
- State.C => switch (c) {
- '\\' => {
- state = State.Backslash;
- result.id = Token.Id.MultilineStringLiteralLine;
- },
- '"' => {
- state = State.StringLiteral;
- result.id = Token.Id.StringLiteral;
- },
- 'a'...'z', 'A'...'Z', '_', '0'...'9' => {
- state = State.Identifier;
- },
- else => break,
- },
State.StringLiteral => switch (c) {
'\\' => {
state = State.StringLiteralBackslash;
@@ -1204,7 +1185,6 @@ pub const Tokenizer = struct {
} else if (self.index == self.buffer.len) {
switch (state) {
State.Start,
- State.C,
State.IntegerLiteral,
State.IntegerLiteralWithRadix,
State.IntegerLiteralWithRadixHex,