Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
Recognizer Class Reference

#include <recognizer.h>

+ Inheritance diagram for Recognizer:
+ Collaboration diagram for Recognizer:

Public Member Functions

 Recognizer (Grammar *grammar, bool no_lines)
 
 ~Recognizer ()
 
bool parse (const QString &input_file=QString())
 
QString decls () const
 
QString impls () const
 

Protected Member Functions

void reallocateStack ()
 
QStringsym (int index)
 
int nextToken ()
 
void inp ()
 
QString expand (const QString &text) const
 

Protected Attributes

int tos
 
int stack_size
 
QList< QStringsym_stack
 
int * state_stack
 
QString _M_contents
 
QString::const_iterator _M_firstChar
 
QString::const_iterator _M_lastChar
 
QString::const_iterator _M_currentChar
 
QChar ch
 
int _M_line
 
int _M_action_line
 
Grammar_M_grammar
 
RulePointer _M_current_rule
 
QString _M_input_file
 
QString _M_decls
 
QString _M_impls
 
QString _M_current_value
 
bool _M_no_lines
 

Additional Inherited Members

- Protected Types inherited from grammar
enum  VariousConstants {
  EOF_SYMBOL = 0 , COLON = 16 , DECL = 19 , DECL_FILE = 3 ,
  ERROR = 21 , EXPECT = 4 , EXPECT_RR = 5 , ID = 1 ,
  IMPL = 20 , IMPL_FILE = 6 , LEFT = 7 , MERGED_OUTPUT = 8 ,
  NONASSOC = 9 , OR = 17 , PARSER = 10 , PREC = 11 ,
  RIGHT = 12 , SEMICOLON = 18 , START = 13 , STRING_LITERAL = 2 ,
  TOKEN = 14 , TOKEN_PREFIX = 15 , ACCEPT_STATE = 68 , RULE_COUNT = 45 ,
  STATE_COUNT = 69 , TERMINAL_COUNT = 22 , NON_TERMINAL_COUNT = 24 , GOTO_INDEX_OFFSET = 69 ,
  GOTO_INFO_OFFSET = 57 , GOTO_CHECK_OFFSET = 57
}
 
- Static Protected Member Functions inherited from grammar
static int nt_action (int state, int nt)
 
static int t_action (int state, int token)
 
- Static Protected Attributes inherited from grammar
static const char *const spell []
 
static const short lhs []
 
static const short rhs []
 
static const short goto_default []
 
static const short action_default []
 
static const short action_index []
 
static const short action_info []
 
static const short action_check []
 

Detailed Description

Definition at line 18 of file recognizer.h.

Constructor & Destructor Documentation

◆ Recognizer()

Recognizer::Recognizer ( Grammar * grammar,
bool no_lines )

Definition at line 14 of file recognizer.cpp.

◆ ~Recognizer()

Recognizer::~Recognizer ( )

Definition at line 25 of file recognizer.cpp.

References stack_size, and state_stack.

Member Function Documentation

◆ decls()

QString Recognizer::decls ( ) const
inline

Definition at line 26 of file recognizer.h.

References _M_decls.

◆ expand()

QString Recognizer::expand ( const QString & text) const
protected

Definition at line 130 of file main.cpp.

References _M_current_rule, _M_grammar, Grammar::names, QString::number(), QString::replace(), Grammar::rules, Grammar::start, Grammar::table_name, text, and QString::toLower().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ impls()

QString Recognizer::impls ( ) const
inline

Definition at line 27 of file recognizer.h.

References _M_impls.

◆ inp()

void Recognizer::inp ( )
inlineprotected

Definition at line 38 of file recognizer.h.

References _M_currentChar, _M_lastChar, _M_line, and ch.

Referenced by nextToken(), and parse().

+ Here is the caller graph for this function:

◆ nextToken()

int Recognizer::nextToken ( )
protected

Definition at line 46 of file recognizer.cpp.

References _M_action_line, _M_current_value, _M_input_file, _M_line, _M_no_lines, ch, QString::clear(), grammar::COLON, grammar::DECL, grammar::DECL_FILE, Qt::endl(), grammar::EOF_SYMBOL, grammar::ERROR, grammar::EXPECT, grammar::EXPECT_RR, forever, QDir::fromNativeSeparators(), grammar::ID, grammar::IMPL, grammar::IMPL_FILE, inp(), grammar::LEFT, grammar::MERGED_OUTPUT, grammar::NONASSOC, QString::number(), grammar::OR, grammar::PARSER, grammar::PREC, qerr(), grammar::RIGHT, grammar::SEMICOLON, grammar::START, grammar::STRING_LITERAL, text, token, grammar::TOKEN, and grammar::TOKEN_PREFIX.

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse()

◆ reallocateStack()

void Recognizer::reallocateStack ( )
inlineprotected

Definition at line 31 of file recognizer.cpp.

References QList< T >::resize(), stack_size, state_stack, and sym_stack.

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sym()

QString & Recognizer::sym ( int index)
inlineprotected

Definition at line 32 of file recognizer.h.

References sym_stack, and tos.

Referenced by parse().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _M_action_line

int Recognizer::_M_action_line
protected

Definition at line 68 of file recognizer.h.

Referenced by nextToken().

◆ _M_contents

QString Recognizer::_M_contents
protected

Definition at line 60 of file recognizer.h.

Referenced by parse().

◆ _M_current_rule

RulePointer Recognizer::_M_current_rule
protected

Definition at line 70 of file recognizer.h.

Referenced by expand(), and parse().

◆ _M_current_value

QString Recognizer::_M_current_value
protected

Definition at line 75 of file recognizer.h.

Referenced by nextToken(), and parse().

◆ _M_currentChar

QString::const_iterator Recognizer::_M_currentChar
protected

Definition at line 63 of file recognizer.h.

Referenced by inp(), and parse().

◆ _M_decls

QString Recognizer::_M_decls
protected

Definition at line 73 of file recognizer.h.

Referenced by decls(), and parse().

◆ _M_firstChar

QString::const_iterator Recognizer::_M_firstChar
protected

Definition at line 61 of file recognizer.h.

Referenced by parse().

◆ _M_grammar

Grammar* Recognizer::_M_grammar
protected

Definition at line 69 of file recognizer.h.

Referenced by expand(), and parse().

◆ _M_impls

QString Recognizer::_M_impls
protected

Definition at line 74 of file recognizer.h.

Referenced by impls(), and parse().

◆ _M_input_file

QString Recognizer::_M_input_file
protected

Definition at line 71 of file recognizer.h.

Referenced by nextToken(), and parse().

◆ _M_lastChar

QString::const_iterator Recognizer::_M_lastChar
protected

Definition at line 62 of file recognizer.h.

Referenced by inp(), and parse().

◆ _M_line

int Recognizer::_M_line
protected

Definition at line 67 of file recognizer.h.

Referenced by inp(), nextToken(), and parse().

◆ _M_no_lines

bool Recognizer::_M_no_lines
protected

Definition at line 76 of file recognizer.h.

Referenced by nextToken().

◆ ch

QChar Recognizer::ch
protected

Definition at line 66 of file recognizer.h.

Referenced by inp(), and nextToken().

◆ stack_size

int Recognizer::stack_size
protected

Definition at line 56 of file recognizer.h.

Referenced by ~Recognizer(), parse(), and reallocateStack().

◆ state_stack

int* Recognizer::state_stack
protected

Definition at line 58 of file recognizer.h.

Referenced by ~Recognizer(), parse(), and reallocateStack().

◆ sym_stack

QList<QString> Recognizer::sym_stack
protected

Definition at line 57 of file recognizer.h.

Referenced by parse(), reallocateStack(), and sym().

◆ tos

int Recognizer::tos
protected

Definition at line 55 of file recognizer.h.

Referenced by parse(), and sym().


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