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


C# antlr.getLine方法代码示例

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


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

示例1: ToLexicalInfo

	protected LexicalInfo ToLexicalInfo(antlr.IToken token)
	{
		int line = token.getLine();
		int startColumn = token.getColumn();
		int endColumn = token.getColumn() + token.getText().Length;
		String filename = token.getFilename();
		return new LexicalInfo(filename, line, startColumn, endColumn);
	}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:8,代码来源:AspectLanguageParser.cs

示例2: OnParserError

 void OnParserError(antlr.RecognitionException error)
 {
     var location = new LexicalInfo(error.getFilename(), error.getLine(), error.getColumn());
     var nvae = error as antlr.NoViableAltException;
     if (null != nvae)
         ParserError(location, nvae);
     else
         GenericParserError(location, error);
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:9,代码来源:WSAIgnoranceParsingStep.cs

示例3: ToSourceLocation

 public static SourceLocation ToSourceLocation(antlr.IToken token)
 {
     return new SourceLocation(token.getLine(), token.getColumn());
 }
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:SourceLocationFactory.cs

示例4: ToLexicalInfo

 public static LexicalInfo ToLexicalInfo(antlr.IToken token)
 {
     return new LexicalInfo(token.getFilename(), token.getLine(), token.getColumn());
 }
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:SourceLocationFactory.cs

示例5: ToEndSourceLocation

 public static SourceLocation ToEndSourceLocation(antlr.IToken token)
 {
     return new SourceLocation(token.getLine(), token.getColumn() + token.getText().Length - 1);
 }
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:SourceLocationFactory.cs

示例6: ToEndSourceLocation

		public static SourceLocation ToEndSourceLocation(antlr.IToken token)
		{
			string text = token.getText() ?? "";
			return new SourceLocation(token.getLine(), token.getColumn() + text.Length - 1);
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:5,代码来源:SourceLocationFactory.cs

示例7: OnParserError

        void OnParserError(antlr.RecognitionException error)
        {
            LexicalInfo data = new LexicalInfo(error.getFilename(), error.getLine(), error.getColumn());

            antlr.NoViableAltException nvae = error as antlr.NoViableAltException;
            if (null != nvae)
            {
                ParserError(data, nvae);
            }
            else
            {
                _context.Errors.Add(CompilerErrorFactory.GenericParserError(data, error));
            }
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:14,代码来源:BooParsingStep.cs

示例8: CreateToken

 antlr.IToken CreateToken(antlr.IToken prototype, int newTokenType, string newTokenText)
 {
     return new BooToken(newTokenType, newTokenText,
         prototype.getFilename(),
         prototype.getLine(),
         prototype.getColumn()+SafeGetLength(prototype.getText()));
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:IndentTokenStreamFilter.cs

示例9: FlushBuffer

        void FlushBuffer(antlr.IToken token)
        {
            if (0 == _buffer.Length) return;

            string text = _buffer.ToString();
            string[] lines = text.Split(NewLineCharArray);

            if (lines.Length > 1)
            {
                string lastLine = lines[lines.Length-1];

                // Protect against mixed indentation issues
                if (String.Empty != lastLine) {
                    if (null == _expectedIndent) {
                        _expectedIndent = lastLine.Substring(0, 1);
                    }

                    if (String.Empty != lastLine.Replace(_expectedIndent, String.Empty))
                    {
                        string literal = _expectedIndent == "\t"
                                       ? "tabs"
                                       : _expectedIndent == "\f"
                                       ? "form feeds"  // The lexer allows them :p
                                       : "spaces";

                        throw new TokenStreamRecognitionException(
                            new RecognitionException(
                                "Mixed indentation, expected the use of " + literal,
                                token.getFilename(),
                                token.getLine(),
                                // Point exactly to the first invalid char
                                lastLine.Length - lastLine.TrimStart(_expectedIndent[0]).Length + 1
                            )
                        );
                    }
                }

                if (lastLine.Length > CurrentIndentLevel)
                {
                    EnqueueIndent(token);
                    _indentStack.Push(lastLine.Length);
                }
                else if (lastLine.Length < CurrentIndentLevel)
                {
                    EnqueueEOS(token);
                    do
                    {
                        EnqueueDedent();
                        _indentStack.Pop();
                    }
                    while (lastLine.Length < CurrentIndentLevel);
                }
                else
                {
                    EnqueueEOS(token);
                }
            }
        }
开发者ID:MaximTrushin,项目名称:boo,代码行数:58,代码来源:IndentTokenStreamFilter.cs

示例10: CalculateEndpoint

        private Tuple<int, int> CalculateEndpoint(antlr.IToken token, int endLine, int endIndex, int delimiterLength)
        {
            var startIndex = positionMap[token.getLine() - 1][token.getColumn() - 1];
            var startLine = token.getLine() - 1;

            if (startLine > endLine || startLine == endLine && startIndex > endIndex)
                whitespaces.Add(new TextSpan { iStartLine = endLine, iStartIndex = endIndex, iEndLine = startLine, iEndIndex = startIndex });

            endLine = startLine - 1;
            endIndex = 0;

            var runningIndex = startIndex + delimiterLength;
            foreach (var part in token.getText().Split(new[] { "\r\n" }, StringSplitOptions.None))
            {
                endLine++;
                endIndex = runningIndex + part.Length;
                runningIndex = 0;
            }
            endIndex += delimiterLength;

            //endIndex = positionMap[endLine][endIndex];

            var cluster = new MappedToken(
                startLine * lineSize + startIndex,
                endIndex - startIndex);

            if (tokenMap.Count > 0
                && tokenMap[tokenMap.Count() - 1].Index >= cluster.Index)
                throw new ArgumentException("Token Mapping order");

            tokenMap.Add(cluster);
            return new Tuple<int, int>(endLine, endIndex);
        }
开发者ID:Rfvgyhn,项目名称:Boo-Plugin,代码行数:33,代码来源:CompileResults.cs


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