Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
01cc5813
Commit
01cc5813
authored
Jan 28, 1999
by
Bob Halley
Browse files
reflect latest lexer changes
parent
72614620
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/tests/lex_test.c
View file @
01cc5813
...
@@ -62,6 +62,9 @@ print_token(isc_token_t *tokenp, FILE *stream) {
...
@@ -62,6 +62,9 @@ print_token(isc_token_t *tokenp, FILE *stream) {
case
isc_tokentype_special
:
case
isc_tokentype_special
:
fprintf
(
stream
,
"SPECIAL %c"
,
tokenp
->
value
.
as_char
);
fprintf
(
stream
,
"SPECIAL %c"
,
tokenp
->
value
.
as_char
);
break
;
break
;
case
isc_tokentype_nomore
:
fprintf
(
stream
,
"NOMORE"
);
break
;
default:
default:
FATAL_ERROR
(
__FILE__
,
__LINE__
,
"Unexpected type %d"
,
FATAL_ERROR
(
__FILE__
,
__LINE__
,
"Unexpected type %d"
,
tokenp
->
type
);
tokenp
->
type
);
...
@@ -77,6 +80,7 @@ main(int argc, char *argv[]) {
...
@@ -77,6 +80,7 @@ main(int argc, char *argv[]) {
int
masterfile
=
1
;
int
masterfile
=
1
;
int
stats
=
0
;
int
stats
=
0
;
unsigned
int
options
=
0
;
unsigned
int
options
=
0
;
int
done
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"qmcs"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"qmcs"
))
!=
-
1
)
{
switch
(
c
)
{
switch
(
c
)
{
...
@@ -107,7 +111,7 @@ main(int argc, char *argv[]) {
...
@@ -107,7 +111,7 @@ main(int argc, char *argv[]) {
isc_lex_setspecials
(
lex
,
specials
);
isc_lex_setspecials
(
lex
,
specials
);
options
=
ISC_LEXOPT_DNSMULTILINE
|
options
=
ISC_LEXOPT_DNSMULTILINE
|
ISC_LEXOPT_EOF
|
ISC_LEXOPT_EOF
|
ISC_LEXOPT_QSTRING
;
ISC_LEXOPT_QSTRING
|
ISC_LEXOPT_NOMORE
;
isc_lex_setcomments
(
lex
,
ISC_LEXCOMMENT_DNSMASTERFILE
);
isc_lex_setcomments
(
lex
,
ISC_LEXCOMMENT_DNSMASTERFILE
);
}
else
{
}
else
{
/* Set up to lex DNS config file. */
/* Set up to lex DNS config file. */
...
@@ -122,7 +126,7 @@ main(int argc, char *argv[]) {
...
@@ -122,7 +126,7 @@ main(int argc, char *argv[]) {
isc_lex_setspecials
(
lex
,
specials
);
isc_lex_setspecials
(
lex
,
specials
);
options
=
ISC_LEXOPT_EOF
|
options
=
ISC_LEXOPT_EOF
|
ISC_LEXOPT_QSTRING
|
ISC_LEXOPT_QSTRING
|
ISC_LEXOPT_NUMBER
;
ISC_LEXOPT_NUMBER
|
ISC_LEXOPT_NOMORE
;
isc_lex_setcomments
(
lex
,
(
ISC_LEXCOMMENT_C
|
isc_lex_setcomments
(
lex
,
(
ISC_LEXCOMMENT_C
|
ISC_LEXCOMMENT_CPLUSPLUS
|
ISC_LEXCOMMENT_CPLUSPLUS
|
ISC_LEXCOMMENT_SHELL
));
ISC_LEXCOMMENT_SHELL
));
...
@@ -131,13 +135,17 @@ main(int argc, char *argv[]) {
...
@@ -131,13 +135,17 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK
(
isc_lex_openstream
(
lex
,
stdin
)
==
ISC_R_SUCCESS
);
RUNTIME_CHECK
(
isc_lex_openstream
(
lex
,
stdin
)
==
ISC_R_SUCCESS
);
while
((
result
=
isc_lex_gettoken
(
lex
,
options
,
&
token
))
==
while
((
result
=
isc_lex_gettoken
(
lex
,
options
,
&
token
))
==
ISC_R_SUCCESS
)
{
ISC_R_SUCCESS
&&
!
done
)
{
if
(
!
quiet
)
{
if
(
!
quiet
)
{
print_token
(
&
token
,
stdout
);
print_token
(
&
token
,
stdout
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
if
(
token
.
type
==
isc_tokentype_eof
)
isc_lex_close
(
lex
);
if
(
token
.
type
==
isc_tokentype_nomore
)
done
=
1
;
}
}
if
(
result
!=
ISC_R_
EOF
)
if
(
result
!=
ISC_R_
SUCCESS
)
printf
(
"Result: %s
\n
"
,
isc_result_totext
(
result
));
printf
(
"Result: %s
\n
"
,
isc_result_totext
(
result
));
isc_lex_close
(
lex
);
isc_lex_close
(
lex
);
...
...
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