void AddSemanticRule(Rule rule, SemanticRule semanticRule) { if (rule != null) { rule.SemanticRules.Add(semanticRule); } }
public Production(SemanticRule rule) : base() { #if GATHERING_STATS InstanceCount++; #endif this.rule = rule; }
public Production(Production p) : this() { this.rule = p.rule; for (int i = 0; i < p.Count; i++) { Add(p[i]); } }
public LR1ParsableLanguage( Language l, TypedShakeSelector <string> selector, Cortex.Grammar.Grammar g, string terminateSymbol, SemanticRule onAccept, bool supressMessages, Func <Token <string>, bool> shouldKeep) : this(l, selector, new LR1Parser(g, terminateSymbol, onAccept, supressMessages), shouldKeep) { }
public EnhancedLR1ParsableLanguage( Language l, TypedShakeSelector <string> selector, EnhancedGrammar g, string terminateSymbol, EnhancedParsingTable table, SemanticRule onAccept, Func <Token <string>, bool> shouldKeep) : this(l, selector, new EnhancedLR1Parser(g, terminateSymbol, table, onAccept), shouldKeep) { }
public LR1ParsableLanguage( Language l, TypedShakeSelector <string> selector, Cortex.Grammar.Grammar g, string terminateSymbol, LR1ParsingTable table, LR1GotoTable gotoTable, SemanticRule onAccept, Func <Token <string>, bool> shouldKeep) : this(l, selector, new LR1Parser(g, terminateSymbol, table, gotoTable, onAccept), shouldKeep) { }
public void Define_rule() { var conditions = new[] { Conditions.NotNull((Order x) => x.Customer), }; var consequences = new[] { Consequences.Delegate((Order o) => _result = o), }; Rule rule = new SemanticRule("RuleA", conditions, consequences); _engine = RulesEngineFactory.New(x => x.Add(rule)); }
public void Define_rule() { var conditions = new[] { Conditions.GreaterThan((Order x) => x.Amount, 10000.0m), }; var consequences = new[] { Consequences.Delegate((Order o) => _result = o), }; Rule rule = new SemanticRule("RuleA", conditions, consequences); _engine = RulesEngineFactory.New(x => x.Add(rule)); }
public void Define_rule() { _results = new List<Tuple<OrderLine, int>>(); var conditions = new[] { Conditions.Each<Order, IList<OrderLine>, OrderLine>(x => x.Lines), }; var consequences = new[] { Consequences.Delegate((Token<Token<Order, IList<OrderLine>>, Tuple<OrderLine, int>> x) => _results.Add(x.Item2)) }; Rule rule = new SemanticRule("RuleA", conditions, consequences); _engine = RulesEngineFactory.New(x => x.Add(rule)); }
public void Define_rule() { _results = new List <Tuple <OrderLine, int> >(); var conditions = new[] { Conditions.Each <Order, IList <OrderLine>, OrderLine>(x => x.Lines), }; var consequences = new[] { Consequences.Delegate((Token <Token <Order, IList <OrderLine> >, Tuple <OrderLine, int> > x) => _results.Add(x.Item2)) }; Rule rule = new SemanticRule("RuleA", conditions, consequences); _engine = RulesEngineFactory.New(x => x.Add(rule)); }
public void Define_rule() { _results = new List <Order>(); var conditions = new[] { Conditions.Exists((Order x) => x.Lines), }; var consequences = new[] { Consequences.Delegate((Order o) => _results.Add(o)), }; Rule rule = new SemanticRule("RuleA", conditions, consequences); _engine = RulesEngineFactory.New(x => x.Add(rule)); }
public void Define_rule() { _results = new List<Order>(); var conditions = new[] { Conditions.Exists((Order x) => x.Lines), }; var consequences = new[] { Consequences.Delegate((Order o) => _results.Add(o)), }; Rule rule = new SemanticRule("RuleA", conditions, consequences); _engine = RulesEngineFactory.New(x => x.Add(rule)); }
public EnhancedLR1ParsableLanguage( string name, string version, string idType, IEnumerable <Comment> comments, IEnumerable <Symbol> symbols, IEnumerable <RegexSymbol> regexSymbols, IEnumerable <Keyword> keywords, TypedShakeSelector <string> selector, EnhancedGrammar g, string terminateSymbol, SemanticRule onAccept, bool supressMessages, Func <Token <string>, bool> shouldKeep) : this(new Language(name, version, idType, comments, symbols, regexSymbols, keywords), selector, g, terminateSymbol, onAccept, supressMessages, shouldKeep) { }
public LR1ParsableLanguage( string name, string version, string idType, IEnumerable <Comment> comments, IEnumerable <Symbol> symbols, IEnumerable <RegexSymbol> regexSymbols, IEnumerable <Keyword> keywords, TypedShakeSelector <string> selector, Cortex.Grammar.Grammar g, string terminateSymbol, LR1ParsingTable table, LR1GotoTable gotoTable, SemanticRule onAccept, Func <Token <string>, bool> shouldKeep) : this(new Language(name, version, idType, comments, symbols, regexSymbols, keywords), selector, g, terminateSymbol, table, gotoTable, onAccept, shouldKeep) { }
public void AddSemanticRule(SemanticRule semanticRule) { AddSemanticRule(this, semanticRule); }
public EnhancedLR1Parser(EnhancedGrammar g, EnhancedParsingTable table, SemanticRule r) : this(g, DEFAULT_TERMINATE_SYMBOL, table, r) { }
public EnhancedLR1Parser(EnhancedGrammar g, string terminateSymbol, EnhancedParsingTable table, SemanticRule r) : base(g, terminateSymbol, r, true, false) { this.table = table; baseToken = new Token <string>(TerminateSymbol, TerminateSymbol, TerminateSymbol.Length); stateStack = new Stack <object>(); initial = new LookaheadRule(TerminateSymbol, TargetGrammar[0]); }
public LR1Parser(Cortex.Grammar.Grammar g, LR1ParsingTable table, LR1GotoTable gotoTable, SemanticRule r) : this(g, DEFAULT_TERMINATE_SYMBOL, table, gotoTable, r) { }
void AddSemanticRule (Rule rule, SemanticRule semanticRule) { if (rule != null) rule.SemanticRules.Add (semanticRule); }
public void Identifier_DoesntMatch_Rule(string sample) { Assert.False(SemanticRule.MatchesRule(sample).HasPassed); }
public LR1Parser(Cortex.Grammar.Grammar g, string terminateSymbol, SemanticRule r, bool supressMessages) : base(g, terminateSymbol, r, supressMessages, true) { }
protected AbstractLR1Parser(AbstractGrammar <R, Encoding> g, string terminateSymbol, SemanticRule r, bool suppressMessages, bool setupRequired) : base(g, terminateSymbol, suppressMessages, setupRequired) { this.onAccept = r; }
public LR1Parser(Cortex.Grammar.Grammar g, string terminateSymbol, SemanticRule r) : this(g, terminateSymbol, r, false) { }
public void AddSemanticRule (string addToRuleName, SemanticRule semanticRule) { AddSemanticRule (GetRule (addToRuleName), semanticRule); }
public LR1Parser(Cortex.Grammar.Grammar g, string terminateSymbol, LR1ParsingTable table, LR1GotoTable gotoTable, SemanticRule r) : base(g, terminateSymbol, r, true, false) { this.actionTable = table; this.gotoTable = gotoTable; this.onAccept = r; baseToken = new Token <string>(TerminateSymbol, TerminateSymbol, TerminateSymbol.Length); stateStack = new Stack <object>(); initial = new LookaheadRule(TerminateSymbol, TargetGrammar[0]); }
public void AddSemanticRule(string addToRuleName, SemanticRule semanticRule) { AddSemanticRule(GetRule(doc, addToRuleName), semanticRule); }
public void Identifier_Matches_Rule(string sample) { Assert.True(SemanticRule.MatchesRule(sample).HasPassed); }
public EnhancedLR1Parser(EnhancedGrammar g, string terminateSymbol, SemanticRule r, bool supressMessages) : base(g, terminateSymbol, r, supressMessages, true) { }
public void NullIdentifier_ThrowsException() { Assert.False(SemanticRule.MatchesRule(null).HasPassed); }
public EnhancedLR1Parser(EnhancedGrammar g, string terminateSymbol, SemanticRule r) : this(g, terminateSymbol, r, false) { }
public void AddSemanticRule (SemanticRule semanticRule) { AddSemanticRule (this, semanticRule); }
protected AbstractMemoizedLR1Parser(AbstractGrammar <R, Encoding> g, string terminateSymbol, SemanticRule r, bool suppressMessages, bool setupRequired) : base(g, terminateSymbol, r, suppressMessages, setupRequired) { }
public static void AddSemanticRule (string mime, string ruleName, SemanticRule rule) { semanticRules.Add (Tuple.Create (mime, ruleName, rule)); }
public static void AddSemanticRule(string mime, string ruleName, SemanticRule rule) { semanticRules.Add(Tuple.Create(mime, ruleName, rule)); }