当前位置: 首页>>代码示例>>C#>>正文


C# CharStream.SkipString方法代码示例

本文整理汇总了C#中CharStream.SkipString方法的典型用法代码示例。如果您正苦于以下问题:C# CharStream.SkipString方法的具体用法?C# CharStream.SkipString怎么用?C# CharStream.SkipString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CharStream的用法示例。


在下文中一共展示了CharStream.SkipString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

				public static AST.INode Parse(CharStream stream)
				{
					var startingPos = stream.Position;
					AST.INode expression = null;

					try
					{
						// skip opening tags
						stream.SkipString("{{");
						WhiteSpace.Parse(stream, true);

						// parse actual expression
						expression = Expression.Parse(stream);

						// skip closing tags
						WhiteSpace.Parse(stream, true);
						stream.SkipString("}}");

						return expression;
					} catch (Exception e)
					{
						string msg = String.Format(
							"something went wrong parsing an <expander> starting at {0}, expression was: {1} ({2})",
							stream.ComputeDetailedPosition(startingPos),
							expression != null ? expression.Display() : "<null>",
							expression != null ? expression.GetType().ToString() : "null");
						throw new Exceptions.ParseException(msg, e);
					}
				}
开发者ID:GlenDC,项目名称:L20n.cs,代码行数:29,代码来源:Expander.cs

示例2: Parse

					public static AST.INode Parse(CharStream stream)
					{
						var startingPos = stream.Position;
						
						try
						{
							AST.INode root;
							if(!Property.PeekAndParse(stream, out root)) {
								root = IdentifierExpression.Parse(stream);
							}
							stream.SkipString("::");

							// we either have an expression or a simple identifier
							AST.INode identifier;
							if (stream.SkipIfPossible('['))
							{
								identifier = Expression.Parse(stream);
								stream.SkipCharacter(']');
							} else
							{
								identifier = new AST.Identifier(Identifier.Parse(stream, false));
							}

							// We can also have optionally a property expression,
							// starting with a simple identifier or straight away with an expression
							AST.PropertyExpression propertyExpression = null;
							if (stream.SkipIfPossible('.'))
							{
								propertyExpression = Property.Parse(stream) as AST.PropertyExpression;
							}
							else if (stream.SkipIfPossible('['))
							{
								var expression = Expression.Parse(stream);
								propertyExpression = new AST.PropertyExpression(expression);
								stream.SkipCharacter(']');
								Property.Parse(stream, propertyExpression);
							}

							return new AST.AttributeExpression(root, identifier, propertyExpression);
						} catch (Exception e)
						{
							string msg = String.Format(
								"something went wrong parsing an <property_expression> starting at {0}",
								stream.ComputeDetailedPosition(startingPos));
							throw new Exceptions.ParseException(msg, e);
						}
					}
开发者ID:GlenDC,项目名称:L20n.cs,代码行数:47,代码来源:Attribute.cs

示例3: Parse

				public static void Parse(CharStream stream, Internal.LocaleContext.Builder builder)
				{
					var startingPos = stream.Position;
					
					try
					{
						stream.SkipString("import(");
						WhiteSpace.Parse(stream, true);
						var path = PureStringValue.Parse(stream);
						WhiteSpace.Parse(stream, true);
						stream.SkipCharacter(')');

						LocalizableObjectsList.ImportAndParse(path, builder);
					} catch (Exception e)
					{
						string msg = String.Format(
							"something went wrong parsing an <import_statement> starting at {0}",
							stream.ComputeDetailedPosition(startingPos));
						throw new Exceptions.ParseException(msg, e);
					}
				}
开发者ID:GlenDC,项目名称:L20n.cs,代码行数:21,代码来源:ImportStatement.cs


注:本文中的CharStream.SkipString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。