Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Chris Müller
cherry
Commits
5b68b0f2
Commit
5b68b0f2
authored
Jul 19, 2013
by
Chris Müller
Browse files
Ignore UTF8-Encoding for simpler Bootstrapping
parent
63f7a1ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
bootstrap/read.c
View file @
5b68b0f2
...
...
@@ -324,8 +324,7 @@ RETURN_TOKEN:
enum
CharState
{
CHAR_EAT
,
CHAR_ESCAPE
,
CHAR_UNICODE
CHAR_ESCAPE
};
static
enum
cherry_tok
...
...
@@ -342,47 +341,13 @@ lex_character(struct cherry_context* context)
cherry_array_append
(
buffer
,
"
\\
"
,
1
);
while
(
!
cherry_unicode_isspace
(
ch
)
&&
ch
!=
'\0'
)
{
switch
(
state
)
{
case
CHAR_EAT
:
if
(
ch
==
'u'
)
{
state
=
CHAR_UNICODE
;
unicount
=
4
;
}
else
if
(
ch
==
'U'
)
{
state
=
CHAR_UNICODE
;
unicount
=
6
;
}
else
{
state
=
CHAR_ESCAPE
;
}
break
;
case
CHAR_UNICODE
:
if
(
unicount
--
==
0
)
goto
RETURN_TOKEN
;
if
((
'0'
>
ch
||
ch
>
'9'
)
&&
(
'A'
>
ch
||
ch
>
'F'
))
{
cherry_error
(
context
,
"Unexpected hex sequence in unicode escape sequence"
);
cherry_array_append
(
buffer
,
"0"
,
1
);
goto
NO_BUFFER_APPEND
;
}
break
;
case
CHAR_ESCAPE
:
break
;
}
cherry_array_append
(
buffer
,
p
,
cherry_utf8_codepoints
(
p
));
NO_BUFFER_APPEND:
p
=
cherry_utf8_next
(
p
);
ch
=
cherry_utf8_get
(
p
);
}
RETURN_TOKEN:
if
(
state
==
CHAR_UNICODE
&&
unicount
>
0
)
{
cherry_error
(
context
,
"Improper unicode escape sequence found in character literal"
);
while
(
unicount
--
>
0
)
cherry_array_append
(
buffer
,
"0"
,
1
);
}
else
if
(
cherry_array_size
(
buffer
)
==
1
)
{
if
(
cherry_array_size
(
buffer
)
==
1
)
{
cherry_error
(
context
,
"No character symbol is given in character literal"
);
cherry_array_append
(
buffer
,
"0"
,
1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment