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


C# Parsing.SourceLocation类代码示例

本文整理汇总了C#中Irony.Parsing.SourceLocation的典型用法代码示例。如果您正苦于以下问题:C# SourceLocation类的具体用法?C# SourceLocation怎么用?C# SourceLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SourceLocation类属于Irony.Parsing命名空间,在下文中一共展示了SourceLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetText

 public void SetText(string text, int offset, bool keepLineNumbering) {
   Text = text;
   //For line-by-line input, automatically increment line# for every new line
   var line = keepLineNumbering ? _location.Line + 1 : 0;
   Location = new SourceLocation(offset, line, 0);
   _nextNewLinePosition = text.IndexOfAny(_scannerData.LineTerminatorsArray, offset);
 }
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:SourceStream.cs

示例2: Reset

 public override void Reset() {
   base.Reset();
   Indents.Clear();
   Indents.Push(0);
   OutputTokens.Clear();
   PreviousToken = null;
   CurrentToken = null;
   PreviousTokenLocation = new SourceLocation();
 }
开发者ID:anukat2015,项目名称:sones,代码行数:9,代码来源:CodeOutlineFilter.cs

示例3: SourceStream

 public SourceStream(string text, bool caseSensitive, int tabWidth, SourceLocation initialLocation) {
   _text = text;
   _textLength = _text.Length; 
   _chars = Text.ToCharArray(); 
   _stringComparison = caseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase;
   _tabWidth = tabWidth; 
   _location = initialLocation;
   _previewPosition = _location.Position;
   if (_tabWidth <= 1) 
     _tabWidth = 8;
 }
开发者ID:mauve,项目名称:Pash,代码行数:11,代码来源:SourceStream.cs

示例4: CreateSpanFor

 protected TextSpan CreateSpanFor(SourceLocation location, int endPosition, Source source)
 {
     var span = new TextSpan
     {
         iStartLine = location.Line,
         iStartIndex = location.Column,
     };
     if (source != null)
         source.GetLineIndexOfPosition(endPosition, out span.iEndLine, out span.iEndIndex);
     return span;
 }
开发者ID:henritersteeg,项目名称:cuke4vs,代码行数:11,代码来源:ParseTreeVisitor.cs

示例5: ScriptExtent

 public ScriptExtent(SourceSpan origSpan, int startOffset, int endOffset)
 {
     if (startOffset == 0 && endOffset == 0)
     {
         _span = origSpan;
         return;
     }
     // create a new span with offsets
     var location = origSpan.Location;
     // we don't adjust line and column for artifical offsets. This is hopefully okay.
     var newLocation = new SourceLocation(location.Position + startOffset, location.Line, location.Column);
     // don't forget to subtract the start offset here
     _span = new SourceSpan(newLocation, origSpan.Length + endOffset - startOffset);
 }
开发者ID:bitwiseman,项目名称:Pash,代码行数:14,代码来源:ScriptExtent.cs

示例6: SourceStream

        public SourceStream(string text, bool caseSensitive, int tabWidth, SourceLocation initialLocation)
        {
            Text = text;
            _textLength = Text.Length;
            _chars = Text.ToCharArray();
#if DNXCORE50
            _stringComparison = caseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
#else
            _stringComparison = caseSensitive
                ? StringComparison.InvariantCulture
                : StringComparison.InvariantCultureIgnoreCase;
#endif
            _tabWidth = tabWidth;
            Location = initialLocation;
            PreviewPosition = Location.Position;
            if (_tabWidth <= 1)
                _tabWidth = 8;
        }
开发者ID:HyperSharp,项目名称:Hyperspace.DotLua,代码行数:18,代码来源:SourceStream.cs

示例7: Reset

 internal void Reset()
 {
     CurrentParserState = Parser.InitialState;
     CurrentParserInput = null;
     CurrentCommentTokens = new TokenList();
     ParserStack.Clear();
     HasErrors = false;
     ParserStack.Push(new ParseTreeNode(CurrentParserState));
     CurrentParseTree = null;
     OpenBraces.Clear();
     ParserTrace.Clear();
     CurrentTerminals.Clear();
     CurrentToken = null;
     PreviousToken = null;
     PreviousLineStart = new SourceLocation(0, -1, 0);
     BufferedTokens.Clear();
     PreviewTokens.Clear();
     Values.Clear();
     foreach (var filter in TokenFilters)
         filter.Reset();
 }
开发者ID:HyperSharp,项目名称:Hyperspace.DotLua,代码行数:21,代码来源:ParsingContext.cs

示例8: ScriptException

 public ScriptException(string message, Exception inner, SourceLocation location, ScriptStackTrace stack) 
        : base(message, inner)  {
   Location = location;
   ScriptStackTrace = stack; 
 }
开发者ID:androdev4u,项目名称:XLParser,代码行数:5,代码来源:ScriptException.cs

示例9: ShowSourceLocationAndTraceToken

 private void ShowSourceLocationAndTraceToken(SourceLocation location, int length)
 {
     ShowSourceLocation(location, length);
       //find token in trace
       for (int i = 0; i < lstTokens.Items.Count; i++) {
     var tkn = lstTokens.Items[i] as Token;
     if (tkn.Location.Position == location.Position) {
       lstTokens.SelectedIndex = i;
       return;
     }//if
       }//for i
 }
开发者ID:BigEd,项目名称:DCPUC,代码行数:12,代码来源:fmGrammarExplorer.cs

示例10: SetNewPosition

 //Computes the Location info (line, col) for a new source position.
 private void SetNewPosition(int newPosition) {
   if (newPosition < Position)
     throw new Exception(Resources.ErrCannotMoveBackInSource); 
   int p = Position; 
   int col = Location.Column;
   int line = Location.Line; 
   while(p <  newPosition) {
     var curr = _chars[p];
     switch (curr) {
       case '\n': line++; col = 0; break;
       case '\r': break; 
       case '\t': col = (col / _tabWidth + 1) * _tabWidth;     break;
       default: col++; break; 
     } //switch
     p++;
   }
   Location = new SourceLocation(p, line, col); 
 }
开发者ID:mauve,项目名称:Pash,代码行数:19,代码来源:SourceStream.cs

示例11: AddParserMessage

 public void AddParserMessage(ErrorLevel level, SourceLocation location, string message, params object[] args)
 {
     if (CurrentParseTree == null) return;
     if (CurrentParseTree.ParserMessages.Count >= MaxErrors) return;
     if (args != null && args.Length > 0)
         message = string.Format(message, args);
     CurrentParseTree.ParserMessages.Add(new LogMessage(level, location, message, CurrentParserState));
     if (TracingEnabled)
         AddTrace(true, message);
 }
开发者ID:HyperSharp,项目名称:Hyperspace.DotLua,代码行数:10,代码来源:ParsingContext.cs

示例12: CompleteMatch

        private Token CompleteMatch(ParsingContext context, ISourceStream source, byte level)
        {
            string text = source.Text.Substring(source.PreviewPosition);
            var matches = Regex.Matches(text, @"\](=*)\]");
            foreach(Match match in matches) 
            {
                if (match.Groups[1].Value.Length == (int)level)
                {
                    source.PreviewPosition += match.Index + match.Length;


                    if (context.VsLineScanState.Value != 0)
                    {
                        SourceLocation tokenStart = new SourceLocation();
                        tokenStart.Position = 0;

                        string lexeme = source.Text.Substring(0, source.PreviewPosition);

                        context.VsLineScanState.Value = 0;
                        return new Token(this, tokenStart, lexeme, null);
                    }
                    else
                    {
                        return source.CreateToken(this.OutputTerminal); 
                    }
                }
            }

            context.VsLineScanState.TerminalIndex = this.MultilineIndex;
            context.VsLineScanState.TokenSubType = level;
            return null;
        }
开发者ID:peterdocter,项目名称:BabeLua,代码行数:32,代码来源:LuaLongStringTerminal.cs

示例13: ShowSourceLocation

 private void ShowSourceLocation(SourceLocation location, int length)
 {
     if (location.Position < 0) return;
       txtSource.SelectionStart = location.Position;
       txtSource.SelectionLength = length;
       //txtSource.Select(location.Position, length);
       txtSource.ScrollToCaret();
       if (tabGrammar.SelectedTab != pageTest)
     tabGrammar.SelectedTab = pageTest;
       txtSource.Focus();
       //lblLoc.Text = location.ToString();
 }
开发者ID:BigEd,项目名称:DCPUC,代码行数:12,代码来源:fmGrammarExplorer.cs

示例14: SourceSpan

 public SourceSpan(SourceLocation location, int length) {
   Location = location;
   Length = length;
 }
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:4,代码来源:SourceLocation.cs

示例15: NeedLineStartToken

 private bool NeedLineStartToken(SourceLocation forLocation) {
   return Grammar.FlagIsSet(LanguageFlags.EmitLineStartToken) && forLocation.Line > Context.PreviousLineStart.Line;
 }
开发者ID:cg123,项目名称:xenko,代码行数:3,代码来源:DefaultScanner.cs


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