コード例 #1
0
ファイル: ColorCoding.cs プロジェクト: woodymax/SSASDiag
        internal void ApplyColor(SSLexLexeme lexeme, Color color)
        {
            ColorSegment item = new ColorSegment {
                Start  = (lexeme.index() - lexeme.length()) - 1,
                Length = lexeme.length(),
                Color  = color
            };

            base.Add(item);
        }
コード例 #2
0
ファイル: Locator.cs プロジェクト: woodymax/SSASDiag
 public Locator(SSLexLexeme lexeme)
 {
     this.Line     = lexeme.line() + 1;
     this.Column   = lexeme.offset() + 1;
     this.Position = (lexeme.index() - lexeme.length()) - 1;
     if (this.Position < 0)
     {
         this.Position = 0;
     }
     this.Length = lexeme.length();
 }
コード例 #3
0
        public override bool error(int State, SSLexLexeme LookaheadToken)
        {
            Message item = new Message(LookaheadToken)
            {
                Type   = MessageType.Error,
                Source = this.m_Source
            };

            item.Location.Adjust(item.Source.StartLocation);
            if (-1 == LookaheadToken.token())
            {
                item.Text = "End of data reached";
            }
            else
            {
                item.Text = "Syntax error while parsing '" + new string(LookaheadToken.lexeme()) + "'";
                this.m_Source.DrawWigglyLine((LookaheadToken.index() - LookaheadToken.length()) - 1, LookaheadToken.length());
            }
            this.m_Errors.Add(item);
            return(base.syncErr());
        }
コード例 #4
0
 private void SetSource(MDXNode node, int start, int end)
 {
     try
     {
         int line     = -1;
         int column   = -1;
         int position = -1;
         int num4     = -1;
         int num5     = start;
         int num6     = end;
         while (num5 <= num6)
         {
             SSLexLexeme lexeme = base.elementFromProduction(num5).lexeme();
             if (lexeme != null)
             {
                 line     = lexeme.line() + 1;
                 column   = lexeme.offset() + 1;
                 position = (lexeme.index() - lexeme.length()) - 1;
             }
             else
             {
                 MDXNode node2 = this.ChildNode(num5);
                 if ((node2 != null) && (node2.Locator.Length != 0))
                 {
                     position = node2.Locator.Position;
                     line     = node2.Locator.Line;
                     column   = node2.Locator.Column;
                 }
             }
             if (position != -1)
             {
                 break;
             }
             num5++;
         }
         node.Locator.Line   = line;
         node.Locator.Column = column;
         while (num6 >= num5)
         {
             SSLexLexeme lexeme2 = base.elementFromProduction(num6).lexeme();
             if (lexeme2 != null)
             {
                 num4 = lexeme2.index() - 1;
             }
             else
             {
                 MDXNode node3 = this.ChildNode(num6);
                 if ((node3 != null) && (node3.Locator.Length != 0))
                 {
                     num4 = node3.Locator.Position + node3.Locator.Length;
                 }
             }
             if (num4 != -1)
             {
                 break;
             }
             num6--;
         }
         for (num5 = start; num5 <= end; num5++)
         {
             SSLexLexeme lexeme3 = base.elementFromProduction(num5).lexeme();
             if ((lexeme3 != null) && (lexeme3.Comments != null))
             {
                 if (node.Comments == null)
                 {
                     node.Comments = new List <string>();
                 }
                 foreach (string str in lexeme3.Comments)
                 {
                     node.Comments.Add(str);
                 }
                 lexeme3.Comments.Clear();
             }
         }
         if ((position != -1) && (num4 != -1))
         {
             node.Locator.Position = position;
             node.Locator.Length   = num4 - position;
             node.Source           = this.m_Source;
         }
     }
     catch (Exception)
     {
     }
 }