DynGenPar
Dynamic Generalized Parser
Public Member Functions | Public Attributes | List of all members
DynGenPar::PgfParser Class Reference

parser for PGF grammars More...

Inheritance diagram for DynGenPar::PgfParser:
Inheritance graph

Public Member Functions

 PgfParser (const Pgf &p)
 
 PgfParser (const QString &fileName, const QString &concreteName=QString())
 
virtual ~PgfParser ()
 
void setInputStdin ()
 
void setInputFile (const QString &fileName)
 
void setInputBytes (const QByteArray &bytes)
 
void setInputString (const QString &string)
 
void setInputBuffer (QByteArray *buffer)
 
QString catName (int cat) const
 
QString functionName (int id) const
 
void filterCoercionsFromSyntaxTree (Node &tree) const
 
- Public Member Functions inherited from DynGenPar::Parser
 Parser (TokenSource *tokenSource)
 
virtual ~Parser ()
 
bool isToken (CatArg cat) const
 
void addToken (CatArg cat)
 
bool isLiteral (const QList< Cat > &list) const
 is a given list of categories a literal? More...
 
void initCaches ()
 clears all caches, then computes the nullable categories and the initial graph More...
 
void addRule (CatArg cat, const Rule &rule)
 adds a new rule to the grammar, updates the nullable categories and the initial graph and clears the other caches More...
 
void loadCfg (const Cfg &cfg)
 
Cfg getCfg ()
 get a Cfg object back from the parser, for serialization More...
 
bool loadPmcfg (const Pmcfg &pmcfg)
 loads a PMCFG in standard form, converting it to the internal representation More...
 
bool addPmcfgRule (Pmcfg &pmcfg, CatArg cat, const Rule &rule)
 adds a new rule to the grammar (both the PMCFG and the internal representation), updates the nullable categories and the initial graph and clears the other caches More...
 
QList< Matchparse (int *errorPos=0, Cat *errorToken=0, int *incrementalPos=0, QList< StackItem > *incrementalStacks=0, QList< Match > *incrementalMatches=0, LexerState *lexerState=0)
 parse the input string More...
 
QList< Matchparse (ParseState *parseState)
 overloaded version using ParseState, for bindings More...
 
Predictions computePredictions (const QList< StackItem > &stacks) const
 compute a set of predictions from the stacks produced by an incremental parse More...
 
Predictions computePredictions (const ParseState &parseState) const
 overloaded version using ParseState, for bindings More...
 
QHash< Cat, QSet< Cat > > expandNonterminalPrediction (CatArg cat) const
 expand a nonterminal prediction to the possible initial tokens and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
QHash< Cat, QSet< Cat > > expandNonterminalPredictionC (CatArg cat)
 expand a nonterminal prediction to the possible initial tokens and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
MultiPredictions computeMultiPredictions (const QList< StackItem > &stacks) const
 compute a set of multi-token predictions from the stacks produced by an incremental parse More...
 
MultiPredictions computeMultiPredictions (const ParseState &parseState) const
 overloaded version using ParseState, for bindings More...
 
QHash< Cat, QSet< QList< Cat > > > expandNonterminalPredictionMulti (CatArg cat) const
 expand a nonterminal prediction to the possible initial nonempty literals (strings of one or more tokens) and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
QHash< Cat, QSet< QList< Cat > > > expandNonterminalPredictionMultiC (CatArg cat)
 expand a nonterminal prediction to the possible initial nonempty literals (strings of one or more tokens) and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
ConstrainedPredictions computeConstrainedPredictions (const QList< StackItem > &stacks) const
 compute a set of predictions from the stacks produced by an incremental parse More...
 
ConstrainedPredictions computeConstrainedPredictions (const ParseState &parseState) const
 overloaded version using ParseState, for bindings More...
 
QHash< Cat, QSet< Cat > > expandNonterminalPredictionC (CatArg cat, const NextTokenConstraints &nextTokenConstraints)
 expand a nonterminal prediction to the possible initial tokens and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
QHash< Cat, QSet< Cat > > expandNonterminalPredictionC (CatArg cat, const QList< NextTokenConstraints > &nextTokenConstraintsList)
 expand a nonterminal prediction to the possible initial tokens and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
ConstrainedMultiPredictions computeConstrainedMultiPredictions (const QList< StackItem > &stacks) const
 compute a set of multi-token predictions from the stacks produced by an incremental parse More...
 
ConstrainedMultiPredictions computeConstrainedMultiPredictions (const ParseState &parseState) const
 overloaded version using ParseState, for bindings More...
 
QHash< Cat, QSet< QList< Cat > > > expandNonterminalPredictionMultiC (CatArg cat, const NextTokenConstraints &nextTokenConstraints)
 expand a nonterminal prediction to the possible initial nonempty literals (strings of one or more tokens) and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 
QHash< Cat, QSet< QList< Cat > > > expandNonterminalPredictionMultiC (CatArg cat, const QList< NextTokenConstraints > &nextTokenConstraintsList)
 expand a nonterminal prediction to the possible initial nonempty literals (strings of one or more tokens) and the nonterminals they immediately reduce to (for categorization), using recursive descent More...
 

Public Attributes

Pgf pgf
 
- Public Attributes inherited from DynGenPar::Parser
RuleSet rules
 grammar rules More...
 
TokenSet tokens
 tokens More...
 
Cat startCat
 start category More...
 
QHash< Cat, QPair< Cat, QList< Cat > > > pseudoCats
 pseudo-categories, used to represent PMCFGs internally More...
 
QHash< Cat, QPair< Cat, int > > componentCats
 maps categories which represent components of a multi-component category to the category and component index they represent More...
 
QHash< Cat, QList< Cat > > catComponents
 maps multi-component categories to the list of their components More...
 

Additional Inherited Members

- Protected Attributes inherited from DynGenPar::Parser
TokenSourceinputSource
 input source More...
 

Detailed Description

parser for PGF grammars

Definition at line 70 of file pgf.h.

Constructor & Destructor Documentation

◆ PgfParser() [1/2]

DynGenPar::PgfParser::PgfParser ( const Pgf p)

Definition at line 1299 of file pgf.cpp.

◆ PgfParser() [2/2]

DynGenPar::PgfParser::PgfParser ( const QString &  fileName,
const QString &  concreteName = QString() 
)

Definition at line 1304 of file pgf.cpp.

◆ ~PgfParser()

virtual DynGenPar::PgfParser::~PgfParser ( )
inlinevirtual

Definition at line 74 of file pgf.h.

Member Function Documentation

◆ catName()

QString DynGenPar::PgfParser::catName ( int  cat) const

Definition at line 1335 of file pgf.cpp.

◆ filterCoercionsFromSyntaxTree()

void DynGenPar::PgfParser::filterCoercionsFromSyntaxTree ( Node tree) const

Definition at line 1355 of file pgf.cpp.

◆ functionName()

QString DynGenPar::PgfParser::functionName ( int  id) const
inline

Definition at line 81 of file pgf.h.

◆ setInputBuffer()

void DynGenPar::PgfParser::setInputBuffer ( QByteArray *  buffer)

Definition at line 1330 of file pgf.cpp.

◆ setInputBytes()

void DynGenPar::PgfParser::setInputBytes ( const QByteArray &  bytes)

Definition at line 1320 of file pgf.cpp.

◆ setInputFile()

void DynGenPar::PgfParser::setInputFile ( const QString &  fileName)

Definition at line 1315 of file pgf.cpp.

◆ setInputStdin()

void DynGenPar::PgfParser::setInputStdin ( )

Definition at line 1310 of file pgf.cpp.

◆ setInputString()

void DynGenPar::PgfParser::setInputString ( const QString &  string)

Definition at line 1325 of file pgf.cpp.

Member Data Documentation

◆ pgf

Pgf DynGenPar::PgfParser::pgf

Definition at line 83 of file pgf.h.


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