public event EventHandler <AstNodeEventArgs> AstNodeCreated; //an event fired after AST node is created. protected internal void OnShifting(ParsingEventArgs args) { if (Shifting != null) { Shifting(this, args); } }
void Term_Shifting(object sender, ParsingEventArgs e) { //Set the values only if we are in the marked state if (!e.Context.CurrentParserState.CustomFlagIsSet(ImpliedPrecedenceCustomFlag)) return; e.Context.CurrentParserInput.Associativity = Associativity; e.Context.CurrentParserInput.Precedence = Precedence; }
public ParsingContext(Parser parser) { this.Parser = parser; Language = Parser.Language; Culture = Language.Grammar.DefaultCulture; SharedParsingEventArgs = new ParsingEventArgs(this); SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this); }
public ParsingContext(Parser parser) { VsLineScanState = new VsScannerStateMap(); Parser = parser; Language = Parser.Language; Culture = Language.Grammar.DefaultCulture; SharedParsingEventArgs = new ParsingEventArgs(this); SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this); }
void Term_Shifting(object sender, ParsingEventArgs e) { //Set the values only if we are in the marked state if (!e.Context.CurrentParserState.CustomFlagIsSet(ImpliedPrecedenceCustomFlag)) { return; } e.Context.CurrentParserInput.Associativity = Associativity; e.Context.CurrentParserInput.Precedence = Precedence; }
public ParsingContext(Parser parser) { Parser = parser; Language = Parser.Language; Culture = Language.Grammar.DefaultCulture; //This might be a problem for multi-threading - if we have several contexts on parallel threads with different culture. //Resources.Culture is static property (this is not Irony's fault, this is auto-generated file). Resources.Culture = Culture; SharedParsingEventArgs = new ParsingEventArgs(this); SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this); }
public ParsingContext(Parser parser) { this.Parser = parser; Language = Parser.Language; Culture = Language.Grammar.DefaultCulture; //This might be a problem for multi-threading - if we have several contexts on parallel threads with different culture. //Resources.Culture is static property (this is not Irony's fault, this is auto-generated file). Resources.Culture = Culture; SharedParsingEventArgs = new ParsingEventArgs(this); SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this); }
public ParsingContext(Parser parser) { this.Parser = parser; Language = Parser.Language; Culture = Language.Grammar.DefaultCulture; //This might be a problem for multi-threading - if we have several contexts on parallel threads with different culture. //Resources.Culture is static property (this is not Irony's fault, this is auto-generated file). Resources.Culture = Culture; //We assume that if Irony is compiled in Debug mode, then developer is debugging his grammar/language implementation #if DEBUG Options |= ParseOptions.GrammarDebugging; #endif SharedParsingEventArgs = new ParsingEventArgs(this); }
void LineComment_ValidateToken(object sender, ParsingEventArgs args) { // if "*" is allowed in the current parser state, suppress comments starting with "*" var parserState = args.Context.CurrentParserState; if (parserState.ExpectedTerminals.Contains(ToTerm("*"))) { // rewind input stream and reject the token // args.Context.SetSourceLocation(args.Context.CurrentToken.Location); args.Context.CurrentToken = null; } }
static void lineNumber_ValidateToken(object sender, ParsingEventArgs e) { if (e.Context.CurrentToken.ValueString.Length > 4) e.Context.CurrentToken = e.Context.CreateErrorToken("Line number cannot be longer than 4 characters"); }
void identifier_ValidateToken(object sender, ParsingEventArgs e) { if (e.Context.CurrentToken.ValueString.Length > 4) e.Context.CurrentToken = e.Context.Source.CreateErrorToken("Identifier cannot be longer than 4 characters"); }
protected internal void OnShifting(ParsingEventArgs args) { Shifting?.Invoke(this, args); }