• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Parsing.SourceLocation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddParserMessage

 public void AddParserMessage(ParserErrorLevel 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 ParserMessage(level, location, message, CurrentParserState));
   if (OptionIsSet(ParseOptions.TraceParser)) 
     ParserTrace.Add( new ParserTraceEntry(CurrentParserState, ParserStack.Top, CurrentParserInput, message, true));
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:9,代码来源:ParsingContext.cs


示例17: RuntimeException

 public RuntimeException(string message, Exception inner, SourceLocation location) : base(message, inner) {
   Location = location;
 }
开发者ID:anukat2015,项目名称:sones,代码行数:3,代码来源:RuntimeException.cs


示例18: VsSetSource

 public void VsSetSource(string text, int offset) {
   var line = Context.Source==null ? 0 : Context.Source.Location.Line;
   var newLoc = new SourceLocation(offset, line + 1, 0);
   Context.Source = new SourceStream(text, Context.Language.Grammar.CaseSensitive, Context.TabWidth, newLoc); 
 }
开发者ID:androdev4u,项目名称:XLParser,代码行数:5,代码来源:Scanner.cs


示例19: AddMessage

 public void AddMessage(ErrorLevel level, SourceLocation location, string message, params object[] args) {
   if (args != null && args.Length > 0)
     message = string.Format(message, args);
   Messages.Add(new LogMessage(level, location, message, null));
 }
开发者ID:androdev4u,项目名称:XLParser,代码行数:5,代码来源:AstContext.cs


示例20: PushOutlineToken

 private void PushOutlineToken(Terminal term, SourceLocation location)
 {
     OutputTokens.Push(new Token(term, location, string.Empty, null));
 }
开发者ID:HyperSharp,项目名称:Hyperspace.DotLua,代码行数:4,代码来源:CodeOutlineFilter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IrrlichtNETCP.SceneNode类代码示例发布时间:2022-05-26
下一篇:
C# Parsing.ParsingContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap