Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1e224b4e
Commit
1e224b4e
authored
Sep 12, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added lexer support for numeric literals.
parent
bb80eaa4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
lex.c
dlls/vbscript/lex.c
+30
-0
parser.y
dlls/vbscript/parser.y
+2
-0
No files found.
dlls/vbscript/lex.c
View file @
1e224b4e
...
...
@@ -240,6 +240,33 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret)
return
tString
;
}
static
int
parse_numeric_literal
(
parser_ctx_t
*
ctx
,
void
**
ret
)
{
double
n
=
0
;
if
(
*
ctx
->
ptr
==
'0'
&&
!
(
'0'
<=
ctx
->
ptr
[
1
]
&&
ctx
->
ptr
[
1
]
<=
'9'
)
&&
ctx
->
ptr
[
1
]
!=
'.'
)
return
*
ctx
->
ptr
++
;
do
{
n
=
n
*
10
+
*
ctx
->
ptr
++
-
'0'
;
}
while
(
'0'
<=
*
ctx
->
ptr
&&
*
ctx
->
ptr
<=
'9'
);
if
(
*
ctx
->
ptr
!=
'.'
)
{
if
((
LONG
)
n
==
n
)
{
LONG
l
=
n
;
*
(
LONG
*
)
ret
=
l
;
return
(
short
)
l
==
l
?
tShort
:
tLong
;
}
}
else
{
double
e
=
1
.
0
;
while
(
'0'
<=
*++
ctx
->
ptr
&&
*
ctx
->
ptr
<=
'9'
)
n
+=
(
e
/=
10
.
0
)
*
(
*
ctx
->
ptr
-
'0'
);
}
*
(
double
*
)
ret
=
n
;
return
tDouble
;
}
static
void
skip_spaces
(
parser_ctx_t
*
ctx
)
{
while
(
*
ctx
->
ptr
==
' '
||
*
ctx
->
ptr
==
'\t'
||
*
ctx
->
ptr
==
'\r'
)
...
...
@@ -256,6 +283,9 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
c
=
*
ctx
->
ptr
;
if
(
'0'
<=
c
&&
c
<=
'9'
)
return
parse_numeric_literal
(
ctx
,
lval
);
if
(
isalphaW
(
c
))
{
int
ret
=
check_keywords
(
ctx
);
if
(
!
ret
)
...
...
dlls/vbscript/parser.y
View file @
1e224b4e
...
...
@@ -74,6 +74,8 @@ static statement_t *new_call_statement(parser_ctx_t*,member_expression_t*);
%token tCLASS tSET tNEW tPUBLIC tPRIVATE tDEFAULT tME
%token tERROR tNEXT tON tRESUME tGOTO
%token <string> tIdentifier tString
%token <lng> tLong tShort
%token <dbl> tDouble
%type <statement> Statement StatementNl
%type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression
...
...
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