コード例 #1
0
ファイル: ParsingContext.cs プロジェクト: rafalFurman/Irony
 public ParsingContext(Parser parser)
 {
     this.Parser                  = parser;
     Language                     = Parser.Language;
     Culture                      = Language.Grammar.DefaultCulture;
     SharedParsingEventArgs       = new ParsingEventArgs(this);
     SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this);
 }
コード例 #2
0
ファイル: ParsingContext.cs プロジェクト: hozuki/irony-vs
 public ParsingContext(Parser parser)
 {
     VsLineScanState              = new VsScannerStateMap();
     Parser                       = parser;
     Language                     = Parser.Language;
     Culture                      = Language.Grammar.DefaultCulture;
     SharedParsingEventArgs       = new ParsingEventArgs(this);
     SharedValidateTokenEventArgs = new ValidateTokenEventArgs(this);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
ファイル: ParsingContext.cs プロジェクト: yangbodevp/irony
 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);
 }
コード例 #5
0
ファイル: PowerShellGrammar.cs プロジェクト: mauve/Pash
        bool IsNewlineExpected(ValidateTokenEventArgs validateTokenEventArgs)
        {
            // Here we check manually if a newline is used as a statement terminator
            // or if it can be skipped (e.g. after `if(exp)`
            // First we have some special cases:

            // detect param, elseif, and else keywords to make sure they aren't misinterpreted as a command
            foreach (var matchTuple in _terms_after_newline)
            {
                if (validateTokenEventArgs.Context.CurrentParserState.ExpectedTerminals.Contains(matchTuple.Item1) &&
                    matchTuple.Item2.IsMatch(validateTokenEventArgs.Context.Source.Text,
                                             validateTokenEventArgs.Context.Source.Position))
                {
                    return false;
                }
            }

            // Now the general case: When the parser has any matching rule witht the newline, it's expected.
            // Otherwise it's optional and we skip it.
            // Remember that `validateTokenEventArgs.Context.CurrentParserState` points in to the finite state machine
            // that Irony generates. `Actions` represents the valid transitions to new states. If this statement is
            // `true`, it means the grammar has a plan for what to do with that `new_line_character`.
            return validateTokenEventArgs.Context.CurrentParserState.Actions.ContainsKey(this.new_line_character);
        }
コード例 #6
0
 bool IsNewlineExpected(ValidateTokenEventArgs validateTokenEventArgs)
 {
     // Remember that `validateTokenEventArgs.Context.CurrentParserState` points in to the finite state machine
     // that Irony generates. `Actions` represents the valid transitions to new states. If this statement is
     // `true`, it means the grammar has a plan for what to do with that `new_line_character`.
     return validateTokenEventArgs.Context.CurrentParserState.Actions.ContainsKey(this.new_line_character);
 }
コード例 #7
0
ファイル: Clarion.cs プロジェクト: PrototypeAlpha/LiveSplit
 void label_ValidateToken(object sender, ValidateTokenEventArgs e) {
   //check that token starts at position 0
   if (e.Token.Location.Column > 0) //Column is 0-based
     e.RejectToken(); 
 }//constructor
コード例 #8
0
ファイル: Clarion.cs プロジェクト: PrototypeAlpha/LiveSplit
 //All numbers are treated as HEX initially; here we need to analyze suffix (if any) and convert the value
 void number_ValidateToken(object sender, ValidateTokenEventArgs e) {
   
 }