diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2005-10-01 15:19:36 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2005-10-01 15:19:36 +0000 |
commit | 154d8ae08733a83bfe0a314d0e4492697eebb143 (patch) | |
tree | 0486f542a03b4adb5b4246bfd2e3e9f3f750da79 /tools/tpg | |
parent | 54695fec80f9bc99f63344b49c6cc589b8d4f138 (diff) | |
download | wireshark-154d8ae08733a83bfe0a314d0e4492697eebb143.tar.gz |
one step further...
TPG now uses the ignore feature of tvbparse
named sub_rules can have cardinality
epan/tvbparse.c:
do not crash on zero cardinality
svn path=/trunk/; revision=16065
Diffstat (limited to 'tools/tpg')
-rw-r--r-- | tools/tpg/tpg.yp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/tpg/tpg.yp b/tools/tpg/tpg.yp index 983d587d3f..98b7e9556c 100644 --- a/tools/tpg/tpg.yp +++ b/tools/tpg/tpg.yp @@ -50,10 +50,16 @@ sub from_to { $b; } + +sub to_hexesc { + sprintf "\\x%.2x", unpack("C",$_[0]); +} + sub chars_control { $_ = $_[0]; s/([a-zA-Z0-9])-([a-zA-Z0-9])/from_to($1,$2)/ge; s/"/\\"/g; + s/\\(.)/to_hexesc($1)/ge; "\"$_\""; } @@ -113,6 +119,13 @@ statement: abort($_[0],"%value_string $name already defined") if exists ${${$parser_info}{vs}}{$name}; ${${$parser_info}{vs}}{$name} = $_[1]; } + | ignore_statement { + ${$parser_info}{ignore} = $_[1]; + } + ; + +ignore_statement: + '%ignore' LOWERCASE {$_[2]} ; rule_statement: @@ -151,7 +164,7 @@ tree: complete_rule: base_rule cardinality qualification {hj($_[1],hj($_[2],$_[3]))} - | named_rule + | named_rule cardinality { hj($_[1],$_[2]) } | until_rule ; |