~berciu-deactivatedaccount/cristallparser/unstable-qt

« back to all changes in this revision

Viewing changes to CristallGrammar.cpp

  • Committer: Sylwke3100
  • Date: 2014-02-03 14:10:31 UTC
  • Revision ID: git-v1:166ce1967fc3953c6a7f9b770d7ff1386b240370
Add new version with rebuild method detect

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "CristallGrammar.h"
2
 
 
3
 
using namespace std;
4
 
using namespace Cristall;
5
 
 
6
 
void CristallGrammar::addGrammar(std::string Label, std::string Char)
7
 
{
8
 
    CristallGrammarModel OperationElement(RuleType::SingleRule, Rules::None, Label, Char, "",RunRuleInside::No, 0);
9
 
   OperationList.push_back(OperationElement);
10
 
}
11
 
 
12
 
void CristallGrammar::addGrammarByGroup(int GroupID, std::string Char)
13
 
{
14
 
    string GroupName = getGroup(GroupID);
15
 
    if (GroupName != "[empty]")
16
 
        addGrammar(GroupName, Char);
17
 
}
18
 
 
19
 
void CristallGrammar::addGrammarTo(std::string Label, std::string StartChar, std::string EndChar, Cristall::RunRuleInside Rule)
20
 
{
21
 
   CristallGrammarModel OperationElement(RuleType::MultiRule, Rules::None, Label, StartChar, EndChar, Rule, 0);
22
 
   OperationList.push_back(OperationElement);
23
 
}
24
 
 
25
 
void CristallGrammar::addGrammarToByGroup(int GroupID , std::string StartChar, std::string EndChar, Cristall::RunRuleInside Rule)
26
 
{
27
 
    string GroupName = getGroup(GroupID);
28
 
    if (GroupName != "[empty]")
29
 
        addGrammarTo(GroupName , StartChar, EndChar, Rule);
30
 
}
31
 
 
32
 
void CristallGrammar::addRule(std::string const& YourName, Cristall::Rules Rule, int Limit)
33
 
{
34
 
    CristallGrammarModel OperationElement(RuleType::SpecialRule, Rule, YourName, "", "", RunRuleInside::No, Limit);
35
 
   OperationList.push_back(OperationElement);
36
 
}