#include "kygrammar.h"
Go to the source code of this file.
Defines | |
| #define | DECREASE_INPUT_QUEUE_LENGTH(_amount_) inputQueueLength -= _amount_ |
| Decrease the length of the input queue by given amount. More... | |
| #define | INCREASE_INPUT_QUEUE_LENGTH(_amount_) |
| Increase the length of the input queue by given amount. More... | |
| #define | TESTEDRULES_POP(_val_, _stack_, _tmpStack_) |
| Pop one tested rule from the stack. More... | |
| #define | TESTEDRULES_PUSH(_val_, _stack_, _tmpStack_) |
| Push one tested rule onto the stack. More... | |
| #define | DIGRAM_REMOVE(_el1_, _el2_) |
| Remove specified digram. More... | |
| #define | DIGRAM_ADD(_el1_, _el2_, _rulePtr_) |
| Add specified digram. More... | |
| #define | DIGRAM_CHANGE(_el1_, _el2_, _rulePtr_) |
| Change of the rule info in specified digram. More... | |
| #define | RIGHT_SIDE_APPEND(_rule_, _el_) |
| Append symbol to specified rule. More... | |
| #define | RIGHT_SIDE_IS_EMPTY(_rule_) (_rule_->last == 0) |
| Test whether given rule is empty. More... | |
| #define | REPRESENTED_BY_APPEND(_list_, _rule_) |
| Append new rule to the list of representatives of the rule element. More... | |
This file contains the definitions of KYGrammar class
Definition in file kygrammar.cpp.
|
|
Decrease the length of the input queue by given amount.
Definition at line 40 of file kygrammar.cpp. Referenced by KYGrammar::eatData. |
|
|
Add specified digram.
Add digram (el1, el2) to list of digrams for symbol el1 (el2 is located in rule rulePtr). Definition at line 122 of file kygrammar.cpp. Referenced by KYGrammar::appendToRootRule, KYGrammar::reductionRule1, KYGrammar::reductionRule2, and KYGrammar::reductionRule3. |
|
|
Value: { \
if (_el1_->type == Terminal) \
nd = terminalDigrams->find(_el1_->value); \
else \
nd = variableDigrams->find(_el1_->rule->id); \
\
if (nd) \
for (r = nd->neighbours.first(); r; r = nd->neighbours.next()) \
if (r->origin == _el2_) \
{ \
r->rule = _rulePtr_; \
break; \
} \
}
Change rule info for digram (el1, el2). Used when this digram goes to another rule (with pointer rulePtr). Definition at line 165 of file kygrammar.cpp. Referenced by KYGrammar::reductionRule1, KYGrammar::reductionRule2, and KYGrammar::reductionRule3. |
|
|
Value: { \
if (_el1_->type == Terminal) \
{nd = terminalDigrams->find(_el1_->value);} \
else \
{nd = variableDigrams->find(_el1_->rule->id);} \
\
if (nd) \
for (r = nd->neighbours.first(); r; r = nd->neighbours.next()) \
if (r->origin == _el2_) \
{ \
nd->neighbours.remove(); \
DELETE(r); \
break; \
} \
}
Remove digram (el1, el2) from list of digrams for symbol el1. Definition at line 99 of file kygrammar.cpp. Referenced by KYGrammar::reductionRule1, KYGrammar::reductionRule2, and KYGrammar::reductionRule3. |
|
|
Value: { \
inputQueueLength += _amount_; \
if (inputQueueLength > maxInputQueueLength) \
maxInputQueueLength = inputQueueLength; \
}
If necessary, maxInputQueueLength is adjusted.
Definition at line 50 of file kygrammar.cpp. Referenced by KYGrammar::append. |
|
|
Value: { \
bool _needInsert_ = true; \
\
for (Rule *_rr_ = _list_.first(); _rr_; _rr_ = _list_.next()) \
{ \
if (_rr_ == _rule_) \
{ \
_needInsert_ = false; \
break; \
} \
} \
if (_needInsert_) \
_list_.append(_rule_); \
}
The _rule_ is appended only if is not contained in the list.
Definition at line 220 of file kygrammar.cpp. Referenced by KYGrammar::reductionRule1, KYGrammar::reductionRule2, and KYGrammar::reductionRule3. |
|
|
Value: if (!_rule_->body) \
{ \
_rule_->body = _el_; \
_rule_->last = _el_; \
_el_->next = 0; \
_el_->prev = 0; \
} \
else \
{ \
_rule_->last->next = _el_; \
_el_->prev = _rule_->last; \
_el_->next = 0; \
_rule_->last = _el_; \
}
Symbol el is appended to the end of rule. Definition at line 187 of file kygrammar.cpp. Referenced by KYGrammar::appendToRootRule. |
|
|
Test whether given rule is empty.
This macro returns true when rule is empty, otherwise it returns false. Definition at line 209 of file kygrammar.cpp. Referenced by KYGrammar::print. |
|
|
Value: { \
_val_ = _stack_->rel; \
_tmpStack_ = _stack_; \
_stack_ = _stack_->next; \
DELETE(_tmpStack_); \
}
Value of the top item on the _stack_ is stored in _val_.
Definition at line 67 of file kygrammar.cpp. Referenced by KYGrammar::ruleMatchesInput. |
|
|
Value: { \
NEW(_tmpStack_, TestedElement); \
_tmpStack_->rel = _val_; \
_tmpStack_->next = _stack_; \
_stack_ = _tmpStack_; \
}
New tested rule with value _val_ is pushed onto the _stack_
Definition at line 85 of file kygrammar.cpp. Referenced by KYGrammar::ruleMatchesInput. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002