public override CommandExecutionResult Execute() { AskSingleValue environmentAsk = new AskSingleValue(); environmentAsk.Text = Resources.EnvironmentAsk; environmentAsk.Prefix = Resources.EnvironmentName; if (environmentAsk.ShowDialog() != DialogResult.OK) { return new CommandExecutionResult(this); } DirectoryInfo envDir = new DirectoryInfo(Path.Combine(project.BuildFile.DirectoryName, EnvIncludeConstants.ENV_FOLDER_NAME)); if (!envDir.Exists) { envDir.Create(); } string targetFileName = string.Format("{0}.{1}.config", project.ProjectName, environmentAsk.Value); FileInfo targetFileInfo = new FileInfo(Path.Combine(envDir.FullName, targetFileName)); if (targetFileInfo.Exists) { CommandExecutionResult result = new CommandExecutionResult(this); result.Error = new ApplicationException(string.Format(Resources.EnvironmnentFileExists, targetFileInfo.FullName)); return result; } ParserContext context = new ParserContext(); context.Set("projectName", project.ProjectName); TemplateHelper.GenerateFile(targetFileInfo, @"EnvFile\env.config", context, Encoding.UTF8); return new CommandExecutionResult(this); }
private string[] ParseLine(string data) { var context = new ParserContext(); ParserState currentState = ParserState.LineStartState; foreach (var ch in data) { switch (ch) { case CommaCharacter: currentState = currentState.Comma(context); break; case QuoteCharacter: currentState = currentState.Quote(context); break; default: currentState = currentState.AnyChar(ch, context); break; } } currentState.EndOfLine(context); return context.Values.ToArray(); }
public string[][] Parse(string csvData) { var context = new ParserContext(); string[] lines = csvData.Split('\n'); ParserState currentState = ParserState.LineStartState; foreach (string next in lines) { foreach (char ch in next) { switch (ch) { case CommaCharacter: currentState = currentState.Comma(context); break; case QuoteCharacter: currentState = currentState.Quote(context); break; default: currentState = currentState.AnyChar(ch, context); break; } } currentState = currentState.EndOfLine(context); } List<string[]> allLines = context.GetAllLines(); return allLines.ToArray(); }
public static Terminal_NumericValue Parse( ParserContext context, string spelling, string regex, int length) { context.Push("NumericValue", spelling + "," + regex); bool parsed = true; Terminal_NumericValue numericValue = null; try { string value = context.text.Substring(context.index, length); if ((parsed = Regex.IsMatch(value, regex))) { context.index += length; numericValue = new Terminal_NumericValue(value, null); } } catch (ArgumentOutOfRangeException) {parsed = false;} context.Pop("NumericValue", parsed); return numericValue; }
public string[][] Parse(TextReader reader) { var context = new ParserContext(); ParserState currentState = ParserState.LineStartState; string next; while ((next = reader.ReadLine()) != null) { foreach (char ch in next) { switch (ch) { case CommaCharacter: currentState = currentState.Comma(context); break; case QuoteCharacter: currentState = currentState.Quote(context); break; default: currentState = currentState.AnyChar(ch, context); break; } } currentState = currentState.EndOfLine(context); } List<string[]> allLines = context.GetAllLines(); return allLines.ToArray(); }
/// <summary> /// Constructor. /// </summary> /// <remarks> /// Note that we are re-using the token reader, so we'll swap out the XamlParser that /// the token reader uses with ourself. Then restore it when we're done parsing. /// </remarks> internal TemplateXamlParser( XamlTreeBuilder treeBuilder, XamlReaderHelper tokenReader, ParserContext parserContext) : this(tokenReader, parserContext) { _treeBuilder = treeBuilder; }
public static Terminal_StringValue Parse( ParserContext context, string regex) { context.Push("StringValue", regex); bool parsed = true; Terminal_StringValue stringValue = null; try { string value = context.text.Substring(context.index, regex.Length); if ((parsed = value.ToLower().Equals(regex.ToLower()))) { context.index += regex.Length; stringValue = new Terminal_StringValue(value, null); } } catch (ArgumentOutOfRangeException) {parsed = false;} context.Pop("StringValue", parsed); return stringValue; }
public ValueState(ParserContext context, ParserNamedParameter param, bool isGlobal, AbstractState returnState) : base(context) { _param = param; _isGlobal = isGlobal; _returnState = returnState; }
public void TestParseHtml() { string path = Path.GetFullPath(TestDataSample.GetHtmlPath("mshome.html")); ParserContext context = new ParserContext(path); IDomParser parser = (IDomParser)ParserFactory.CreateDom(context); ToxyDom toxyDom = parser.Parse(); List<ToxyNode> metaNodeList = toxyDom.Root.SelectNodes("//meta"); Assert.AreEqual(7, metaNodeList.Count); ToxyNode aNode = toxyDom.Root.SingleSelect("//a"); Assert.AreEqual(1, aNode.Attributes.Count); Assert.AreEqual("href", aNode.Attributes[0].Name); Assert.AreEqual("http://www.microsoft.com/en/us/default.aspx?redir=true", aNode.Attributes[0].Value); ToxyNode titleNode = toxyDom.Root.ChildrenNodes[0].ChildrenNodes[0].ChildrenNodes[0]; Assert.AreEqual("title", titleNode.Name); Assert.AreEqual("Microsoft Corporation", titleNode.ChildrenNodes[0].ToText()); ToxyNode metaNode = toxyDom.Root.ChildrenNodes[0].ChildrenNodes[0].ChildrenNodes[7]; Assert.AreEqual("meta", metaNode.Name); Assert.AreEqual(3, metaNode.Attributes.Count); Assert.AreEqual("name", metaNode.Attributes[0].Name); Assert.AreEqual("SearchDescription", metaNode.Attributes[0].Value); Assert.AreEqual("scheme", metaNode.Attributes[2].Name); Assert.AreEqual(string.Empty, metaNode.Attributes[2].Value); }
public void BaseTestWithHeaderRow(string filename) { ParserContext context = new ParserContext(TestDataSample.GetExcelPath(filename)); ISpreadsheetParser parser = ParserFactory.CreateSpreadsheet(context); parser.Context.Properties.Add("HasHeader", "1"); ToxySpreadsheet ss = parser.Parse(); Assert.AreEqual(1, ss.Tables[0].HeaderRows.Count); Assert.AreEqual("A", ss.Tables[0].HeaderRows[0].Cells[0].Value); Assert.AreEqual("B", ss.Tables[0].HeaderRows[0].Cells[1].Value); Assert.AreEqual("C", ss.Tables[0].HeaderRows[0].Cells[2].Value); Assert.AreEqual("D", ss.Tables[0].HeaderRows[0].Cells[3].Value); Assert.AreEqual(3, ss.Tables[0].Rows.Count); Assert.AreEqual("1", ss.Tables[0].Rows[0].Cells[0].Value); Assert.AreEqual("2", ss.Tables[0].Rows[0].Cells[1].Value); Assert.AreEqual("3", ss.Tables[0].Rows[0].Cells[2].Value); Assert.AreEqual("4", ss.Tables[0].Rows[0].Cells[3].Value); Assert.AreEqual("A1", ss.Tables[0].Rows[1].Cells[0].Value); Assert.AreEqual("A2", ss.Tables[0].Rows[1].Cells[1].Value); Assert.AreEqual("A3", ss.Tables[0].Rows[1].Cells[2].Value); Assert.AreEqual("A4", ss.Tables[0].Rows[1].Cells[3].Value); Assert.AreEqual("B1", ss.Tables[0].Rows[2].Cells[0].Value); Assert.AreEqual("B2", ss.Tables[0].Rows[2].Cells[1].Value); Assert.AreEqual("B3", ss.Tables[0].Rows[2].Cells[2].Value); Assert.AreEqual("B4", ss.Tables[0].Rows[2].Cells[3].Value); }
public override sealed CommandExecutionResult Execute() { CommandExecutionResult result = new CommandExecutionResult(this); try { CheckOutUICommand checkOutCommand = new CheckOutUICommand(Selection); checkOutCommand.DoNotCheckOutWhenLocalDirectoryExists = true; checkOutCommand.ReportProgress += delegate(object sender, IUICommandReportProgressEventArgs eventArgs) { InvokeReportProgress(eventArgs.Message); }; CommandExecutionResult checkOutCommandExecutionResult = checkOutCommand.Execute(); if (checkOutCommandExecutionResult.Error != null) throw checkOutCommandExecutionResult.Error; ParserContext context = new ParserContext(); FillContext(context); DirectoryInfo targetDir = new DirectoryInfo((string)checkOutCommandExecutionResult.CommandOutput); TemplateHelper.GenerateTemplateHierarchy(targetDir, baseTemplateDir, context, Encoding); result.CommandOutput = targetDir; result.NewProjectFile = new FileInfo(Path.Combine(targetDir.FullName, string.Concat(GetProjectName(Selection.SvnUri), ".nant"))); } catch (Exception ex) { result.Error = ex; } return result; }
public static bool BindLiteralOrReference(ParserContext context, XObject xmlObject, string xmlValue, PropertyInfo boundProperty) { object convertedLiteralValue; if (LiteralTypeConverter.TryConvert(boundProperty.PropertyType, xmlValue, out convertedLiteralValue)) { if (BindExpression(context, xmlObject, xmlValue, boundProperty)) { return true; } BindFinalValue(boundProperty, context.FrameworkItem, convertedLiteralValue, xmlObject, true); return true; } if (xmlObject is XAttribute) { if (BindExpression(context, xmlObject, xmlValue, boundProperty)) { return true; } DelayedBind(context, xmlObject, xmlValue, boundProperty); return true; } return false; }
CommandLineParameter ToCommandLineParameter(string arg, ParserContext context) { return !arg.StartsWith("-") ? CreatePositionalCommandLineParameter(arg, context) : CreateNamedCommandLineParameter(arg, context); }
internal override void ProcessProperty(int index, LineTypes.Property line, IParentObject obj, Stack<GameObject> objectStack, ParserContext context) { if (objectStack.Count > 0) { base.ObjectProcessProperty(index, line, obj, objectStack, context); return; } if (context == this.context) { ShipTilePrefab tile = (ShipTilePrefab)obj; switch (index) { case 0: tile.ID = line.argumentsData[0].ToString(); break; case 1: tile.EditorName = line.argumentsData[0].ToString(); break; case 2: tile.EditorDescription = line.argumentsData[0].ToString(); break; case 3: tile.EditorThumbnail = (Texture2D)line.argumentsData[0]; break; case 4: tile.Mass = (float)line.argumentsData[0]; break; case 5: tile.HP = (int)line.argumentsData[0]; break; } return; } throw new Exception("Invalid member in parsed lines list"); }
public override void Close(ParserContext context) { base.Close(context); Tight = true; // tight by default foreach (var item in Children) { // check for non-final list item ending with blank line: if (item.EndsWithBlankLine && item != LastChild) { Tight = false; break; } // recurse into children of list item, to see if there are // spaces between any of them: foreach (var subItem in item.Children) { if (subItem.EndsWithBlankLine && (item != LastChild || subItem != item.LastChild)) { Tight = false; break; } } } }
public void TestParseLineEvent() { string path = TestDataSample.GetTextPath("utf8.txt"); ParserContext context = new ParserContext(path); PlainTextParser parser = (PlainTextParser)ParserFactory.CreateText(context); parser.ParseLine += (sender, args) => { if (args.LineNumber == 0) { Assert.AreEqual("hello world", args.Text); } else if(args.LineNumber==1) { Assert.AreEqual("a2", args.Text); } else if (args.LineNumber == 2) { Assert.AreEqual("a3", args.Text); } else if (args.LineNumber == 3) { Assert.AreEqual("bbb4", args.Text); } }; string text = parser.Parse(); }
/// <summary> /// Constructor. /// </summary> internal MarkupExtensionParser( IParserHelper parserHelper, ParserContext parserContext) { _parserHelper = parserHelper; _parserContext = parserContext; }
public static CommandLineParameters Parse([NotNull] string commandline) { Verify.ArgumentNotNull(commandline, "commandline"); var context = new ParserContext(commandline); return context.Parse(); }
public static RouteStatement Parse(ParserContext context) { var keyword = context.ReadNextToken(); if (keyword.Text != "ROUTE") { throw new InvalidVRMLSyntaxException("ROUTE expected"); } var nodeOut = context.ParseNodeNameId(); if (context.ReadNextToken().Text != ".") { throw new InvalidVRMLSyntaxException(); } var eventOut = context.ParseEventOutId(); if (context.ReadNextToken().Text != "TO") { throw new InvalidVRMLSyntaxException(); } var nodeIn = context.ParseNodeNameId(); if (context.ReadNextToken().Text != ".") { throw new InvalidVRMLSyntaxException(); } var eventIn = context.ParseEventInId(); return new RouteStatement { NodeOut = nodeOut, EventOut = eventOut, NodeIn = nodeIn, EventIn = eventIn }; }
public static ExternInterfaceDeclarationsStatement Parse(ParserContext context) { var res = new ExternInterfaceDeclarationsStatement(); context.ReadOpenBracket(); do { var token = context.PeekNextToken(); if (token.Type == VRML97TokenType.CloseBracket) { context.ReadCloseBracket(); break; } switch (token.Text) { case "eventIn": var eventIn = ExternEventInStatement.Parse(context); res.EventsIn.Add(eventIn); break; case "eventOut": var eventOut = ExternEventOutStatement.Parse(context); res.EventsOut.Add(eventOut); break; case "field": var field = ExternFieldStatement.Parse(context); res.Fields.Add(field); break; case "exposedField": var exposedField = ExternExposedFieldStatement.Parse(context); res.ExposedFields.Add(exposedField); break; default: throw new InvalidVRMLSyntaxException(); } } while (true); return res; }
public void ToExpression() { // Arrange ConstantExpression expression = Expression.Constant(42); ParserContext context = new ParserContext(); context.HoistedValues.Add(null); context.HoistedValues.Add(null); ConstantExpressionFingerprint fingerprint = ConstantExpressionFingerprint.Create(expression, context); // Act Expression result = fingerprint.ToExpression(context); // Assert Assert.AreEqual(ExpressionType.Convert, result.NodeType, "Returned expression should have been a cast."); UnaryExpression castExpr = (UnaryExpression)result; Assert.AreEqual(typeof(int), castExpr.Type); Assert.AreEqual(ExpressionType.ArrayIndex, castExpr.Operand.NodeType, "Inner expression should have been an array lookup."); BinaryExpression arrayLookupExpr = (BinaryExpression)castExpr.Operand; Assert.AreEqual(ParserContext.HoistedValuesParameter, arrayLookupExpr.Left); Assert.AreEqual(ExpressionType.Constant, arrayLookupExpr.Right.NodeType, "Index of array lookup should be a constant expression."); ConstantExpression indexExpr = (ConstantExpression)arrayLookupExpr.Right; Assert.AreEqual(2, indexExpr.Value, "Wrong index output."); }
static void AddDefault(ParserContext context) { if (context.Scenario != null) { if (context.Steps.Count == 0) { context.Errors.Add (new Error (ErrorType.Error, "Expecting Given, When or Then", new DomRegion (context.LineNumber, context.Column, context.LineNumber, 1 + context.Content.Length))); } } }
public override void AddError(ParserContext context) { if (context != null && context.ErrorList != null) { context.ErrorList.AddError( context.InsertionErrorId, InsertPoint, CorrectionToken); } }
public override void AddError(ParserContext context) { if (context != null && context.ErrorList != null) { context.ErrorList.AddError( context.DeletionErrorId, UnexpectedLexeme.Value.Span, UnexpectedLexeme.Value); } }
/// <summary> /// Convert from Xaml read by a token reader into baml being written /// out by a record writer. The context gives mapping information. /// </summary> #if !PBTCOMPILER //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)] #endif internal virtual void ConvertXamlToBaml ( XamlReaderHelper tokenReader, ParserContext context, XamlNode xamlNode, BamlRecordWriter bamlWriter) { throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize)); }
public override void AddError(ParserContext context) { if (context != null && context.ErrorManager != null) { context.ErrorManager.AddError( ErrorId, ErrorSpan, Parameters); } }
public void TestParseMp3_Id3v2Only() { string path = Path.GetFullPath(TestDataSample.GetAudioPath("sample_v2_only.mp3")); ParserContext context = new ParserContext(path); IMetadataParser parser = (IMetadataParser)ParserFactory.CreateMetadata(context); ToxyMetadata x = parser.Parse(); Assert.AreEqual(15, x.Count); }
//public static ParseResultCollection Parse(string text) //{ // return ParseResultCollection.InternalParse(text,new PlaceNameParser(text)); //} public PlaceNameParser(ParserContext context) { this.context = context; if (placeNamesTrie == null) placeNamesTrie = context.GetServerInstance(); placeNamesTrie.Connect(context.ServerEndPoint); }
public void TestParseFlac() { string path = Path.GetFullPath(TestDataSample.GetAudioPath("sample.flac")); ParserContext context = new ParserContext(path); IMetadataParser parser = (IMetadataParser)ParserFactory.CreateMetadata(context); ToxyMetadata x = parser.Parse(); Assert.AreEqual(16, x.Count); }
public List<CommandLineParameter> Parse(string[] args) { var context = new ParserContext(); return args .Where(s => s != null && s.Trim() != "") .Select(arg => ToCommandLineParameter(arg, context)).ToList(); }
public abstract ParserState EndOfLine(ParserContext context);
public override ParserState Comma(ParserContext context) { context.AddValue(); return(ValueStartState); }
public override ParserState Quote(ParserContext context) { context.AddChar(QuoteCharacter); return(ValueState); }
/// <summary> /// Returns the matching <see cref="PatternSegment"/> for the given <paramref name="serverVariable"/> /// </summary> /// <param name="serverVariable">The server variable</param> /// <param name="context">The parser context which is utilized when an exception is thrown</param> /// <param name="uriMatchPart">Indicates whether the full URI or the path should be evaluated for URL segments</param> /// <param name="alwaysUseManagedServerVariables">Determines whether server variables are sourced from the managed server</param> /// <exception cref="FormatException">Thrown when the server variable is unknown</exception> /// <returns>The matching <see cref="PatternSegment"/></returns> public static PatternSegment FindServerVariable(string serverVariable, ParserContext context, UriMatchPart uriMatchPart, bool alwaysUseManagedServerVariables) { Func <PatternSegment>?managedVariableThunk = default; switch (serverVariable) { // TODO Add all server variables here. case "ALL_RAW": managedVariableThunk = () => throw new NotSupportedException(Resources.FormatError_UnsupportedServerVariable(serverVariable)); break; case "APP_POOL_ID": managedVariableThunk = () => throw new NotSupportedException(Resources.FormatError_UnsupportedServerVariable(serverVariable)); break; case "CONTENT_LENGTH": managedVariableThunk = () => new HeaderSegment(HeaderNames.ContentLength); break; case "CONTENT_TYPE": managedVariableThunk = () => new HeaderSegment(HeaderNames.ContentType); break; case "HTTP_ACCEPT": managedVariableThunk = () => new HeaderSegment(HeaderNames.Accept); break; case "HTTP_COOKIE": managedVariableThunk = () => new HeaderSegment(HeaderNames.Cookie); break; case "HTTP_HOST": managedVariableThunk = () => new HeaderSegment(HeaderNames.Host); break; case "HTTP_REFERER": managedVariableThunk = () => new HeaderSegment(HeaderNames.Referer); break; case "HTTP_USER_AGENT": managedVariableThunk = () => new HeaderSegment(HeaderNames.UserAgent); break; case "HTTP_CONNECTION": managedVariableThunk = () => new HeaderSegment(HeaderNames.Connection); break; case "HTTP_URL": managedVariableThunk = () => new UrlSegment(uriMatchPart); break; case "HTTPS": managedVariableThunk = () => new IsHttpsUrlSegment(); break; case "LOCAL_ADDR": managedVariableThunk = () => new LocalAddressSegment(); break; case "HTTP_PROXY_CONNECTION": managedVariableThunk = () => throw new NotSupportedException(Resources.FormatError_UnsupportedServerVariable(serverVariable)); break; case "QUERY_STRING": managedVariableThunk = () => new QueryStringSegment(); break; case "REMOTE_ADDR": managedVariableThunk = () => new RemoteAddressSegment(); break; case "REMOTE_HOST": managedVariableThunk = () => throw new NotSupportedException(Resources.FormatError_UnsupportedServerVariable(serverVariable)); break; case "REMOTE_PORT": managedVariableThunk = () => new RemotePortSegment(); break; case "REQUEST_FILENAME": managedVariableThunk = () => new RequestFileNameSegment(); break; case "REQUEST_METHOD": managedVariableThunk = () => new RequestMethodSegment(); break; case "REQUEST_URI": managedVariableThunk = () => new UrlSegment(uriMatchPart); break; default: throw new FormatException(Resources.FormatError_InputParserUnrecognizedParameter(serverVariable, context.Index)); } if (alwaysUseManagedServerVariables) { return(managedVariableThunk()); } return(new IISServerVariableSegment(serverVariable, managedVariableThunk)); }
public ByteArrayJsonConverter(ParserContext ctx) { _ctx = ctx; }
public abstract ParserState Comma(ParserContext context);
public override Statement Parse(ParseTreeNode node, ParserContext context) { var statements = context.CurrentBlock.Statements; return(new DelegateStatement((writer, encoder, ctx) => WriteToAsync(writer, encoder, ctx, statements))); }
public override List <Expression> Compile(Scope scope, ParserContext context) { return(base.Compile(scope, context)); }
public override ParserState Quote(ParserContext context) { return(QuoteState); }
public override ParserState AnyChar(char ch, ParserContext context) { //undefined, ignore " context.AddChar(ch); return(QuotedValueState); }
internal override Expression ResolveNames(ParserContext parser) { this.PrimaryExpression = this.PrimaryExpression.ResolveNames(parser); this.SecondaryExpression = this.SecondaryExpression.ResolveNames(parser); return(this); }
internal override Executable PastelResolve(ParserContext parser) { this.Target = this.Target.PastelResolve(parser); this.Value = this.Value.PastelResolve(parser); return(this); }
public static Rule_VCHAR Parse(ParserContext context) { context.Push("VCHAR"); Rule rule; bool parsed = true; ParserAlternative b; int s0 = context.index; ParserAlternative a0 = new ParserAlternative(s0); List <ParserAlternative> as1 = new List <ParserAlternative>(); parsed = false; { int s1 = context.index; ParserAlternative a1 = new ParserAlternative(s1); parsed = true; if (parsed) { bool f1 = true; int c1 = 0; for (int i1 = 0; i1 < 1 && f1; i1++) { rule = Terminal_NumericValue.Parse(context, "%x21-7E", "[\\x21-\\x7E]", 1); if ((f1 = rule != null)) { a1.Add(rule, context.index); c1++; } } parsed = c1 == 1; } if (parsed) { as1.Add(a1); } context.index = s1; } b = ParserAlternative.GetBest(as1); parsed = b != null; if (parsed) { a0.Add(b.rules, b.end); context.index = b.end; } rule = null; if (parsed) { rule = new Rule_VCHAR(context.text.Substring(a0.start, a0.end - a0.start), a0.rules); } else { context.index = s0; } context.Pop("VCHAR", parsed); return((Rule_VCHAR)rule); }
protected override void Update(ParserContext context, string value) { context.Comments.Add(value.PoDeNormalize()); }
public abstract ParserState AnyChar(char ch, ParserContext context);
public override ParserState EndOfLine(ParserContext context) { return(QuotedValueState); }
public override ParserState EndOfLine(ParserContext context) { return(LineStartState); }
public override ParserState Comma(ParserContext context) { context.AddChar(CommaCharacter); return(QuotedValueState); }
private IConfigurableObjectDefinition ParseDbProviderFactoryObject(XmlElement element, string name, ParserContext parserContext) { string typeName = GetTypeName(element); string providerNameAttribute = GetAttributeValue(element, DbProviderFactoryObjectConstants.ProviderNameAttribute); string connectionString = GetAttributeValue(element, DbProviderFactoryObjectConstants.ConnectionStringAttribute); MutablePropertyValues propertyValues = new MutablePropertyValues(); if (StringUtils.HasText(providerNameAttribute)) { propertyValues.Add("Provider", providerNameAttribute); } if (StringUtils.HasText(connectionString)) { propertyValues.Add("ConnectionString", connectionString); } IConfigurableObjectDefinition cod = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition( typeName, null, parserContext.ReaderContext.Reader.Domain); cod.PropertyValues = propertyValues; return(cod); }
internal override Expression ResolveNames(ParserContext parser) { this.Root = this.Root.ResolveNames(parser); this.BatchExpressionNameResolver(parser, this.Items); return(this); }
public static Rule_query Parse(ParserContext context) { context.Push("query"); Rule rule; bool parsed = true; ParserAlternative b; int s0 = context.index; ParserAlternative a0 = new ParserAlternative(s0); List <ParserAlternative> as1 = new List <ParserAlternative>(); parsed = false; { int s1 = context.index; ParserAlternative a1 = new ParserAlternative(s1); parsed = true; if (parsed) { bool f1 = true; int c1 = 0; while (f1) { int g1 = context.index; List <ParserAlternative> as2 = new List <ParserAlternative>(); parsed = false; { int s2 = context.index; ParserAlternative a2 = new ParserAlternative(s2); parsed = true; if (parsed) { bool f2 = true; int c2 = 0; for (int i2 = 0; i2 < 1 && f2; i2++) { rule = Rule_pchar.Parse(context); if ((f2 = rule != null)) { a2.Add(rule, context.index); c2++; } } parsed = c2 == 1; } if (parsed) { as2.Add(a2); } context.index = s2; } { int s2 = context.index; ParserAlternative a2 = new ParserAlternative(s2); parsed = true; if (parsed) { bool f2 = true; int c2 = 0; for (int i2 = 0; i2 < 1 && f2; i2++) { rule = Terminal_StringValue.Parse(context, "/"); if ((f2 = rule != null)) { a2.Add(rule, context.index); c2++; } } parsed = c2 == 1; } if (parsed) { as2.Add(a2); } context.index = s2; } { int s2 = context.index; ParserAlternative a2 = new ParserAlternative(s2); parsed = true; if (parsed) { bool f2 = true; int c2 = 0; for (int i2 = 0; i2 < 1 && f2; i2++) { rule = Terminal_StringValue.Parse(context, "?"); if ((f2 = rule != null)) { a2.Add(rule, context.index); c2++; } } parsed = c2 == 1; } if (parsed) { as2.Add(a2); } context.index = s2; } b = ParserAlternative.GetBest(as2); parsed = b != null; if (parsed) { a1.Add(b.rules, b.end); context.index = b.end; } f1 = context.index > g1; if (parsed) { c1++; } } parsed = true; } if (parsed) { as1.Add(a1); } context.index = s1; } b = ParserAlternative.GetBest(as1); parsed = b != null; if (parsed) { a0.Add(b.rules, b.end); context.index = b.end; } rule = null; if (parsed) { rule = new Rule_query(context.text.Substring(a0.start, a0.end - a0.start), a0.rules); } else { context.index = s0; } context.Pop("query", parsed); return((Rule_query)rule); }
public override ParserState EndOfLine(ParserContext context) { context.AddValue(); return(LineStartState); }
private IConfigurableObjectDefinition ParseDbProviderConfigurer(XmlElement element, string name, ParserContext parserContext) { string typeName = GetTypeName(element); string resource = GetAttributeValue(element, DbProviderConfigurerConstants.ResourceAttribute); MutablePropertyValues propertyValues = new MutablePropertyValues(); if (StringUtils.HasText(resource)) { propertyValues.Add("ProviderResource", resource); } IConfigurableObjectDefinition cod = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition( typeName, null, parserContext.ReaderContext.Reader.Domain); cod.PropertyValues = propertyValues; return(cod); }
public abstract ParserState Quote(ParserContext context);
public static Rule_time_hour Parse(ParserContext context) { context.Push("time-hour"); Rule rule; bool parsed = true; ParserAlternative b; int s0 = context.index; ParserAlternative a0 = new ParserAlternative(s0); List <ParserAlternative> as1 = new List <ParserAlternative>(); parsed = false; { int s1 = context.index; ParserAlternative a1 = new ParserAlternative(s1); parsed = true; if (parsed) { bool f1 = true; int c1 = 0; for (int i1 = 0; i1 < 2 && f1; i1++) { rule = Rule_DIGIT.Parse(context); if ((f1 = rule != null)) { a1.Add(rule, context.index); c1++; } } parsed = c1 == 2; } if (parsed) { as1.Add(a1); } context.index = s1; } b = ParserAlternative.GetBest(as1); parsed = b != null; if (parsed) { a0.Add(b.rules, b.end); context.index = b.end; } rule = null; if (parsed) { rule = new Rule_time_hour(context.text.Substring(a0.start, a0.end - a0.start), a0.rules); } else { context.index = s0; } context.Pop("time-hour", parsed); return((Rule_time_hour)rule); }
public override ParserState AnyChar(char ch, ParserContext context) { context.AddChar(ch); return(ValueState); }
public CrayonExecutableParser(ParserContext parser) : base(parser) { }
public static Rule_path_empty Parse(ParserContext context) { context.Push("path-empty"); Rule rule; bool parsed = true; ParserAlternative b; int s0 = context.index; ParserAlternative a0 = new ParserAlternative(s0); List <ParserAlternative> as1 = new List <ParserAlternative>(); parsed = false; { int s1 = context.index; ParserAlternative a1 = new ParserAlternative(s1); parsed = true; if (parsed) { bool f1 = true; int c1 = 0; while (f1) { rule = Rule_pchar.Parse(context); if ((f1 = rule != null)) { a1.Add(rule, context.index); c1++; } } parsed = true; } if (parsed) { as1.Add(a1); } context.index = s1; } b = ParserAlternative.GetBest(as1); parsed = b != null; if (parsed) { a0.Add(b.rules, b.end); context.index = b.end; } rule = null; if (parsed) { rule = new Rule_path_empty(context.text.Substring(a0.start, a0.end - a0.start), a0.rules); } else { context.index = s0; } context.Pop("path-empty", parsed); return((Rule_path_empty)rule); }
internal override Expression PastelResolve(ParserContext parser) { throw new System.NotImplementedException(); }
internal override Expression ResolveTypes(ParserContext parser, TypeResolver typeResolver) { this.ResolvedType = ResolvedType.GetClassRefType(this.ClassDefinition); return(this); }