示例#1
0
        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;
 }
示例#3
0
 public ParsingContext(Parser parser)
 {
     this.Parser                  = parser;
     Language                     = Parser.Language;
     Culture                      = Language.Grammar.DefaultCulture;
     SharedParsingEventArgs       = new ParsingEventArgs(this);
     SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this);
 }
示例#4
0
 public ParsingContext(Parser parser)
 {
     VsLineScanState              = new VsScannerStateMap();
     Parser                       = parser;
     Language                     = Parser.Language;
     Culture                      = Language.Grammar.DefaultCulture;
     SharedParsingEventArgs       = new ParsingEventArgs(this);
     SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this);
 }
示例#5
0
 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);
 }
示例#7
0
 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);
 }
示例#8
0
        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);
        }
示例#9
0
		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;
			}
		}
    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); 
    }
示例#11
0
 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");
 }
示例#12
0
 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");
 }
示例#13
0
 protected internal void OnShifting(ParsingEventArgs args)
 {
     Shifting?.Invoke(this, args);
 }