Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
91cc7bd7
Commit
91cc7bd7
authored
13 years ago
by
Jacek Caban
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
vbscript: Added identifiers support to lexer.
parent
9f849269
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/vbscript/lex.c
+28
-0
28 additions, 0 deletions
dlls/vbscript/lex.c
dlls/vbscript/parse.h
+1
-0
1 addition, 0 deletions
dlls/vbscript/parse.h
dlls/vbscript/parser.y
+13
-3
13 additions, 3 deletions
dlls/vbscript/parser.y
with
42 additions
and
3 deletions
dlls/vbscript/lex.c
+
28
−
0
View file @
91cc7bd7
...
...
@@ -26,6 +26,31 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
vbscript
);
static
inline
BOOL
is_identifier_char
(
WCHAR
c
)
{
return
isalnumW
(
c
)
||
c
==
'_'
;
}
static
int
parse_identifier
(
parser_ctx_t
*
ctx
,
const
WCHAR
**
ret
)
{
const
WCHAR
*
ptr
=
ctx
->
ptr
++
;
WCHAR
*
str
;
int
len
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
is_identifier_char
(
*
ctx
->
ptr
))
ctx
->
ptr
++
;
len
=
ctx
->
ptr
-
ptr
;
str
=
parser_alloc
(
ctx
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
str
)
return
0
;
memcpy
(
str
,
ptr
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
str
[
len
]
=
0
;
*
ret
=
str
;
return
tIdentifier
;
}
static
int
parse_next_token
(
void
*
lval
,
parser_ctx_t
*
ctx
)
{
WCHAR
c
;
...
...
@@ -37,6 +62,9 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx)
c
=
*
ctx
->
ptr
;
if
(
isalphaW
(
c
))
return
parse_identifier
(
ctx
,
lval
);
switch
(
c
)
{
case
'\n'
:
ctx
->
ptr
++
;
...
...
This diff is collapsed.
Click to expand it.
dlls/vbscript/parse.h
+
1
−
0
View file @
91cc7bd7
...
...
@@ -30,3 +30,4 @@ typedef struct {
HRESULT
parse_script
(
parser_ctx_t
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
int
parser_lex
(
void
*
,
parser_ctx_t
*
)
DECLSPEC_HIDDEN
;
void
*
parser_alloc
(
parser_ctx_t
*
,
size_t
)
DECLSPEC_HIDDEN
;
This diff is collapsed.
Click to expand it.
dlls/vbscript/parser.y
+
13
−
3
View file @
91cc7bd7
...
...
@@ -38,13 +38,12 @@ static void parse_complete(parser_ctx_t*);
%pure_parser
%start Program
%token tEOF
%union {
const WCHAR *string;
}
%token tNL
%token tEOF tNL
%token <string> tIdentifier
%%
...
...
@@ -62,6 +61,17 @@ static void parse_complete(parser_ctx_t *ctx)
ctx->parse_complete = TRUE;
}
void *parser_alloc(parser_ctx_t *ctx, size_t size)
{
void *ret;
/* FIXME: leaks! */
ret = heap_alloc(size);
if(!ret)
ctx->hres = E_OUTOFMEMORY;
return ret;
}
HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code)
{
ctx->code = ctx->ptr = code;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment