Example #1
0
 private void Parse(string script)
 {
     try
     {
         var parser = new Language.Parser {
             ProduceV2Tokens = true
         };
         parser.Parse(null, script, _tokenList, out _errors, ParseMode.Default);
     }
     catch (Exception)
     {
     }
 }
Example #2
0
 private void Parse(string script)
 {
     try
     {
         var parser = new Language.Parser {
             ProduceV2Tokens = true
         };
         parser.Parse(null, script, _tokenList, out _errors, ParseMode.Default);
     }
     catch (Exception e)
     {
         // Catch everything, die on fatal exceptions, otherwise ignore
         CommandProcessorBase.CheckForSevereException(e);
     }
 }
Example #3
0
        internal ScriptBlock ParseScriptBlock(string script, string fileName, bool addToHistory)
        {
            ParseError[] errors;
            var          ast = EngineParser.Parse(fileName, script, null, out errors, ParseMode.Default);

            if (addToHistory)
            {
                EngineParser.SetPreviousFirstLastToken(Context);
            }

            if (errors.Any())
            {
                if (errors[0].IncompleteInput)
                {
                    throw new IncompleteParseException(errors[0].Message, errors[0].ErrorId);
                }
                throw new ParseException(errors);
            }

            return(new ScriptBlock(ast, isFilter: false));
        }