retdec
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
retdec::llvmir2hll::APICallInfoSeqParser Class Reference

A parser of textual representation of API call sequences. More...

#include <api_call_info_seq_parser.h>

Inheritance diagram for retdec::llvmir2hll::APICallInfoSeqParser:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::APICallInfoSeqParser:
Collaboration graph
[legend]

Public Member Functions

std::optional< APICallInfoSeqparse (const std::string &text) const
 Parses the given text into a sequence of API calls information. More...
 

Static Public Member Functions

static ShPtr< APICallInfoSeqParsercreate ()
 Creates a new parser. More...
 

Private Member Functions

 APICallInfoSeqParser ()
 Constructs an APICallInfoSeqParser instance. More...
 
- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Detailed Description

A parser of textual representation of API call sequences.

The textual representation of an API call sequence has to be of the form

info1
info2
info3
...

where every infoX is of the form

[X = ] func([args])[;]
static RegisterPass< LlvmIr2Hll > X("retdec-llvmir2hll", "LLVM IR -> HLL", false, false)

where

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:

URLDownloadToFile(_, _, X)
Y = fopen(X)
fwrite(_, _, _, Y)
fclose(Y)

(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.

Constructor & Destructor Documentation

◆ APICallInfoSeqParser()

retdec::llvmir2hll::APICallInfoSeqParser::APICallInfoSeqParser ( )
private

Constructs an APICallInfoSeqParser instance.

Member Function Documentation

◆ create()

ShPtr< APICallInfoSeqParser > retdec::llvmir2hll::APICallInfoSeqParser::create ( )
static

Creates a new parser.

◆ parse()

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.


The documentation for this class was generated from the following files: