internal Group(CompiledGrammar owner, int index, string name, GroupAdvanceMode advanceMode, GroupEndingMode endingMode) : base(owner, index) { this.name = name; this.advanceMode = advanceMode; this.endingMode = endingMode; nesting = new GrammarObjectSet <Group>(); }
/// <summary> /// Creates a new instance of <c>Rule</c> class. /// </summary> /// <param name="index">Index of the rule in the grammar rule table.</param> internal Rule(CompiledGrammar owner, int index) : base(owner, index) { if (owner == null) { throw new ArgumentNullException("owner"); } }
public RuleDeclarationParser(CompiledGrammar grammar) { if (grammar == null) { throw new ArgumentNullException("grammar"); } this.grammar = grammar; }
public Rule Bind(CompiledGrammar grammar) { if (grammar == null) { throw new ArgumentNullException("grammar"); } Rule rule; RuleDeclarationParser.TryBindGrammar(parsedRule, grammar, out rule); return rule; }
/// <summary> /// Creates a new instance of <c>Symbol</c> class. /// </summary> /// <param name="index">Symbol index in symbol table.</param> /// <param name="name">Name of the symbol.</param> /// <param name="kind">Type of the symbol.</param> internal Symbol(CompiledGrammar owner, int index, string name, SymbolKind kind) : base(owner, index) { if (owner == null) { throw new ArgumentNullException("owner"); } this.name = string.IsInterned(name) ?? name; this.kind = kind; }
protected GrammarXmlProcessor(CompiledGrammar grammar, XmlReader transform) { if (grammar == null) { throw new ArgumentNullException("grammar"); } this.grammar = grammar; if (transform == null) { throw new ArgumentNullException("stylesheet"); } this.transform = new XslCompiledTransform(false); this.transform.Load(transform, new XsltSettings(false, false), null); nametable = transform.NameTable; }
public FormulaInterpreter(System.IO.BinaryReader reader) { grammar = CompiledGrammar.Load(reader); actions = new SemanticTypeActions<GCToken>(grammar); try { actions.Initialize(true); } catch (InvalidOperationException ex) { System.Diagnostics.Debug.Write(ex.Message); } }
public FormulaInterpreter(System.IO.BinaryReader reader) { grammar = CompiledGrammar.Load(reader); actions = new SemanticTypeActions<GCToken>(grammar); try { actions.Initialize(true); } catch (System.Exception e) { Core.ApplicationData.Instance.Logger.AddLog(this, e); } }
public void load() { log.Debug("Loading grammar..."); grammar = CompiledGrammar.Load(typeof(MathToken), "math-grammar.cgt"); log.Debug("Loading actions..."); actions = new SemanticTypeActions<MathToken>(grammar); try { actions.Initialize(true); } catch (InvalidOperationException e) { log.Error("Error initializing actions", e); return; } log.Info("Plugin successfully loaded."); }
internal DfaCharset(CompiledGrammar owner, int index, string charset) : base(owner, index) { if (string.IsNullOrEmpty(charset)) { throw new ArgumentException("Empty charsets are not supported", "charset"); } charsetIncludingSequence = charset.ToCharArray(); Array.Sort(charsetIncludingSequence); char currentStartChar = charsetIncludingSequence[0]; char currentChar = currentStartChar; sequenceStart = currentStartChar; sequenceEnd = currentStartChar; int sequenceLength = 1; int currentLength = 1; for (int i = 1; i < charsetIncludingSequence.Length; i++) { currentChar++; if (charsetIncludingSequence[i] == currentChar) { currentLength++; if (currentLength > sequenceLength) { sequenceLength = currentLength; sequenceStart = currentStartChar; sequenceEnd = currentChar; } } else { currentLength = 1; currentStartChar = charsetIncludingSequence[i]; currentChar = currentStartChar; } } charsetExcludingSequence = new char[charsetIncludingSequence.Length - sequenceLength]; int charsetIndex = 0; foreach (char c in charsetIncludingSequence) { if ((c < sequenceStart) || (c > sequenceEnd)) { charsetExcludingSequence[charsetIndex++] = c; } } Debug.Assert(charsetIndex == charsetExcludingSequence.Length); }
public RuleTrimAttributeTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public GrammarObjectSetTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public override void Warmup(XmlTestSuite suite) { grammar = CompiledGrammar.Load(new BinaryReader(GetType().Assembly.GetManifestResourceStream("Eto.Parse.TestSpeed.Tests.Xml.Gold.XML.egt"))); Parse(suite); }
internal static CompiledGrammar GetGrammar() { lock (sync) { if (compiledGrammar == null) { compiledGrammar = CompiledGrammar.Load(typeof(ScriptParser), "ModuleStoreSQL.egt"); } return compiledGrammar; } }
public LalrProcessorTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public TerminalAttributeTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public CgtTokenizerTest() { grammar = CgtCompiledGrammarTest.LoadCgtTestGrammar(); }
public SemanticTypeActionsTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public ParameterMatching() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public EgtTokenizerTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
public Tests() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
static GoldGrammarTable() { goldGrammarV1 = loadFromResource (v1Resource); goldGrammarV5 = loadFromResource (v5Resource); }
public BsnGoldBenchmark() { grammar = CompiledGrammar.Load(new BinaryReader(GetType().Assembly.GetManifestResourceStream("Eto.Parse.TestSpeed.Tests.Json.Gold.JSON.egt"))); }
public void SetUp() { grammar = ScriptParser.GetGrammar(); }
public Symbol Bind(CompiledGrammar grammar) { if (grammar == null) { throw new ArgumentNullException("grammar"); } Symbol result; grammar.TryGetSymbol(symbolName, out result); return result; }
/// <summary> /// Initializes a new instance of the <see cref="GrammarObject<TSelf>"/> class. /// </summary> /// <param name="owner">The owner grammar.</param> /// <param name="index">The index.</param> protected GrammarObject(CompiledGrammar owner, int index) { this.owner = owner; this.index = index; }
public TestEmpty(CompiledGrammar dummy) { if (dummy != null) { throw new InvalidOperationException("Expected a null dummy"); } }
public TestBsnGold() { grammar = CompiledGrammar.Load(new BinaryReader(GetType().Assembly.GetManifestResourceStream("Eto.Parse.TestSpeed.Tests.Xml.Gold.XML.egt"))); }
public SymbolTypeMapTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }
internal static bool TryBindGrammar(Reduction ruleDeclaration, CompiledGrammar grammar, out Rule rule) { Symbol ruleSymbol; if (grammar.TryGetSymbol(GetRuleSymbolName(ruleDeclaration), out ruleSymbol)) { ReadOnlyCollection<Rule> rules; if (grammar.TryGetRulesForSymbol(ruleSymbol, out rules)) { List<Symbol> symbols = new List<Symbol>(); foreach (string handleName in GetRuleHandleNames(ruleDeclaration)) { Symbol symbol; if (!grammar.TryGetSymbol(handleName, out symbol)) { symbols = null; break; } symbols.Add(symbol); } if (symbols != null) { foreach (Rule currentRule in rules) { if (currentRule.Matches(symbols)) { rule = currentRule; return true; } } } } } rule = null; return false; }
static GrammarParser() { goldGrammar = GoldGrammarTable.GetCompiledGrammar (CgtVersion.None); }
public RuleDeclarationParserTest() { grammar = EgtCompiledGrammarTest.LoadEgtTestGrammar(); }