aboutsummaryrefslogtreecommitdiffstats
path: root/epan/protobuf_lang_parser.lemon
AgeCommit message (Collapse)AuthorFilesLines
2021-04-16Add missing prototypes to lemon-generated code.Gerald Combs1-0/+4
Add static prototypes for the parser interface functions. Fixes -Wmissing-prototypes found by clang.
2021-04-02protobuf: Fix leaking nodes and stringsTomasz Moń1-1/+1
Closes #17305
2021-03-27protobuf: fix leaking tokensTomasz Moń1-3/+5
Move scanner destroy call to pbl_clear_state() so it is freed if parsing fails. This eliminates most of leaked memory reported in #17305.
2021-03-26protobuf: free memory used by scanner after parsingTomasz Moń1-0/+2
Closes #17305
2020-12-27Protobuf: fix bugs that parsing complex syntax .proto filesHuang Qiangxiong1-9/+53
Some .proto files contain complex syntax that does not be described in protobuf official site (https://developers.google.com/protocol-buffers/docs/reference/proto3-spec). 1. Update 'epan/protobuf_lang_parser.lemon' to: 1) Support complex option names format (EBNF): optionName = ( ident | "(" fullIdent ")" ) { "." ( ident | "(" fullIdent ")" ) } for example, "option (complex_opt2).(grault) = 654;". 2) Make enum body support 'reserved' section (EBNF): enumBody = "{" { reserved | option | enumField | emptyStatement } "}" 3) Allow the value of field or enumValue option to be "{ ... }" other than constant: enumValueOption = optionName "=" ( constant | customOptionValue ) ";" fieldOption = optionName "=" ( constant | customOptionValue ) ";" 4) Allow 'group' section missing 'label' (for example, in 'oneof' section). 5) Make 'oneof' section support 'option' and 'group' sections (BNF): oneof = "oneof" oneofName "{" { oneofField | option | group | emptyStatement } "}" 6) Ignore unused 'extend' section. 7) Fix the bug of one string being splitted into multi-lines. 2. Update 'epan/protobuf_lang_tree.c' to: 8) Fix the bug of parsing repeated option. 3. Update 'test/suite_dissection.py' to add test case for parsing complex syntax .proto files: test/protobuf_lang_files/complex_proto_files/unittest_custom_options.proto test/protobuf_lang_files/complex_proto_files/complex_syntax.proto and dependency files: test/protobuf_lang_files/well_know_types/google/protobuf/any.proto test/protobuf_lang_files/well_know_types/google/protobuf/descriptor.proto Refer to issue #17046
2020-12-09Fix various spelling errors.Guy Harris1-1/+1
Found by lintian and by looking for the misspelled words that lintian found. (Does not fix spelling errors in .asn1 files.)
2020-11-18Protobuf: rewrite parser of *.proto file from Bison to LemonHuang Qiangxiong1-0/+632
In order to avoid Bison's compatibility problem (like https://code.wireshark.org/review/#/c/33771/), the *.proto file parser is rewritten with lemon. (rename protobuf_lang.y.in to protobuf_lang_parser.lemon) Also improved the mechanism of recording line number of message, field, and enum names.