本文整理汇总了C#中TextNode.setLineNumber方法的典型用法代码示例。如果您正苦于以下问题:C# TextNode.setLineNumber方法的具体用法?C# TextNode.setLineNumber怎么用?C# TextNode.setLineNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextNode
的用法示例。
在下文中一共展示了TextNode.setLineNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parseText
private Node parseText()
{
Token token = expect(typeof (Text))
;
Node node = new TextNode();
node.setValue(token.getValue());
node.setLineNumber(token.getLineNumber());
node.setFileName(filename);
return node;
}
示例2: parseTextBlock
private Node parseTextBlock()
{
TextNode textNode = new TextNode();
textNode.setLineNumber(line());
textNode.setFileName(filename);
Token token = expect(typeof (Indent));
Indent indentToken = (Indent) token;
int spaces = indentToken.getIndents();
if (null == this._spaces)
this._spaces = spaces;
String indentStr = StringUtils.repeat(" ", spaces - this._spaces.Value);
while (!(peek() is Outdent))
{
if (peek() is Eos)
break;
if (peek() is Newline)
{
textNode.appendText("\n");
this.nextToken();
}
else if (peek() is Indent)
{
textNode.appendText("\n");
textNode.appendText(this.parseTextBlock().getValue());
textNode.appendText("\n");
}
else
{
textNode.appendText(indentStr + this.nextToken().getValue());
}
}
if (spaces == this._spaces)
this._spaces = null;
if (peek() is Eos)
return textNode;
token = expect(typeof(Outdent));
return textNode;
}
示例3: parseInclude
private Node parseInclude()
{
Token token = expect(typeof (Include));
Include includeToken = (Include) token;
String templateName = includeToken.getValue().Trim();
String extension = Path.GetExtension(templateName);
if (!"".Equals(extension) && !"jade".Equals(extension))
{
FilterNode node = new FilterNode();
node.setLineNumber(_jadeLexer.getLineno());
node.setFileName(filename);
node.setValue(extension);
try
{
TextReader reader = templateLoader.getReader(resolvePath(templateName));
Node textNode = new TextNode();
textNode.setFileName(filename);
textNode.setLineNumber(_jadeLexer.getLineno());
textNode.setValue(reader.ReadToEnd());
node.setTextBlock(textNode);
}
catch (IOException e)
{
throw new JadeParserException(filename, _jadeLexer.getLineno(), templateLoader,
"the included file [" + templateName + "] could not be opened\n" + e.Message);
}
return node;
}
JadeParser jadeParser = createParser(templateName);
jadeParser.setBlocks(blocks);
contexts.AddLast(jadeParser);
Node ast = jadeParser.parse();
contexts.RemoveLast();
if (peek() is Indent && ast is BlockNode)
{
((BlockNode) ast).getIncludeBlock().push(block());
}
return ast;
}