public override void Init(Grammar grammar) { base.Init(grammar); //Remove new line chars from whitespace foreach(char t in LineTerminators) Grammar.WhitespaceChars = Grammar.WhitespaceChars.Replace(t.ToString(), string.Empty); }
public LanguageCompiler(Grammar grammar) { Grammar = grammar; grammar.Init(); ScannerControlData scannerData = new ScannerControlData(grammar); Scanner = new Scanner(scannerData); Parser = new Lalr.Parser(Grammar); }
public override void Init(Grammar grammar) { base.Init(grammar); //_endSymbolsFirsts char array is used for fast search for end symbols using String's method IndexOfAny(...) _endSymbolsFirsts = new char[EndSymbols.Count]; for (int i = 0; i < EndSymbols.Count; i++) { string sym = EndSymbols[i]; _endSymbolsFirsts[i] = sym[0]; _isLineComment |= sym.Contains("\n"); } if (this.EditorInfo == null) { TokenType ttype = _isLineComment ? TokenType.LineComment : TokenType.Comment; this.EditorInfo = new TokenEditorInfo(ttype, TokenColor.Comment, TokenTriggers.None); } }
public override void Init(Grammar grammar) { base.Init(grammar); if (String.IsNullOrEmpty(QuickParseTerminators)) QuickParseTerminators = grammar.WhitespaceChars + grammar.Delimiters; _defaultFloatTypes = new TypeCode[] { DefaultFloatType }; if (this.EditorInfo == null) this.EditorInfo = new TokenEditorInfo(TokenType.Literal, TokenColor.Number, TokenTriggers.None); }