retdec
|
A parser of textual representation of API call sequences. More...
#include <api_call_info_seq_parser.h>
Public Member Functions | |
std::optional< APICallInfoSeq > | parse (const std::string &text) const |
Parses the given text into a sequence of API calls information. More... | |
Static Public Member Functions | |
static ShPtr< APICallInfoSeqParser > | create () |
Creates a new parser. More... | |
Private Member Functions | |
APICallInfoSeqParser () | |
Constructs an APICallInfoSeqParser instance. More... | |
![]() | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable ()=default | |
~NonCopyable ()=default | |
A parser of textual representation of API call sequences.
The textual representation of an API call sequence has to be of the form
where every infoX
is of the form
where
X =
is an optional bind to an identifier X
;func
is the name of the function;args
is an optional list of arguments, specified later;
; is an optional semicolon to end the info.An identifier (ID for short) has to be of the form [_a-zA-Z0-9]+. Every argument has to be an ID. If the ID is
_
, then such an argument is irrelevant. This means that values are not bound to this argument or checked that they match with it. Arguments are separated by commas. Whitespace is irrelevant and it is skipped.
Example:
(Recall that the semicolons at the end of every info are only optional.)
For more examples, see the unit tests for this class, located in APICallInfoSeqParserTest.cpp.
Instances of this class have reference object semantics. Use create() to create instances.
|
private |
Constructs an APICallInfoSeqParser instance.
|
static |
Creates a new parser.
std::optional< APICallInfoSeq > retdec::llvmir2hll::APICallInfoSeqParser::parse | ( | const std::string & | text | ) | const |
Parses the given text into a sequence of API calls information.
See the class description for a description of the format of text.
If text is invalid, it returns std::nullopt
. If text is empty, it returns an empty sequence.