diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2003-07-25 03:44:05 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2003-07-25 03:44:05 +0000 |
commit | 086774b71f236b797a9e7a14e2bbb444b55e6d79 (patch) | |
tree | c295c5d9f4e05517f4d56f17032183c996ab27df /epan/dfilter/grammar.lemon | |
parent | c2150d9d778613bb7eb8135ea1f155346f26e473 (diff) |
Add to the fundamental types passed between the scanner and the parser.
Besides "STRING", there is now "UNPARSED_STRING", where the distinction
is that "STRING" was a double-quoted string and "UNPARSED_STRING" is just
a sequence of characters that the scanner didn't know how to scan/parse,
so it's up to the Ftype to parse it.
This gives us more flexibility and prepares the dfilter parsing engine
for the upcoming addition of the "contains" operator.
In the process of doing this, I also re-did the double-quoted string
support in the scanner, so that instead of the naively-simple support we
used to have, double-quoted strings now can have embedded dobule-quotes,
embedded octal sequences, and embedded hexadecimal sequences:
"\"" embedded double-quote
"\110" embedded octal
"\x48" embedded hex
Enhance the dfilter unit test script to be able to run a single collection
of tests instead of having to run all of them all the time.
svn path=/trunk/; revision=8083
Diffstat (limited to 'epan/dfilter/grammar.lemon')
-rw-r--r-- | epan/dfilter/grammar.lemon | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/epan/dfilter/grammar.lemon b/epan/dfilter/grammar.lemon index e252b496a8..35310adf7d 100644 --- a/epan/dfilter/grammar.lemon +++ b/epan/dfilter/grammar.lemon @@ -1,4 +1,4 @@ -/* $Id: grammar.lemon,v 1.4 2001/06/22 16:29:13 gram Exp $ */ +/* $Id: grammar.lemon,v 1.5 2003/07/25 03:44:01 gram Exp $ */ %include { #ifdef HAVE_CONFIG_H @@ -71,6 +71,10 @@ any "error" symbols are shifted, if possible. */ dfilter_fail("The string \"%s\" was unexpected in this context.", stnode_data(TOKEN)); break; + case STTYPE_UNPARSED: + dfilter_fail("\"%s\" was unexpected in this context.", + stnode_data(TOKEN)); + break; case STTYPE_INTEGER: dfilter_fail("The integer %u was unexpected in this context.", stnode_value(TOKEN)); @@ -150,18 +154,9 @@ logical_test(T) ::= FIELD(F). /* Entities, or things that can be compared/tested/checked */ entity(E) ::= FIELD(F). { E = F; } entity(E) ::= STRING(S). { E = S; } +entity(E) ::= UNPARSED(U). { E = U; } entity(E) ::= range(R). { E = R; } -/* CIDR: ADDRESS/NET */ -entity(E) ::= STRING(A) SLASH STRING(N). -{ - E = stnode_new(STTYPE_STRING, g_strjoin("/", stnode_data(A), - stnode_data(N), NULL)); - - stnode_free(A); - stnode_free(N); -} - /* Ranges */ range(R) ::= FIELD(F) LBRACKET drnode_list(L) RBRACKET. |