Scanner.cs :  » Development » StyleCop » Microsoft » VisualStudio » Package » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Development » StyleCop 
StyleCop » Microsoft » VisualStudio » Package » Scanner.cs
using System;

namespace Microsoft.VisualStudio.Package{
    /// <include file='doc\Scanner.uex' path='docs/doc[@for="IScanner"]/*' />
    /// <summary>
    /// Scans individual source lines and provides coloring and trigger information about tokens.
    /// </summary>
    public interface IScanner {
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="IScanner.SetSource"]/*' />
        /// <summary>
        /// Used to (re)initialize the scanner before scanning a small portion of text, such as single source line for syntax coloring purposes
        /// </summary>
        /// <param name="source">The source text portion to be scanned</param>
        /// <param name="offset">The index of the first character to be scanned</param>
        void SetSource(string source, int offset);

        /// <include file='doc\Scanner.uex' path='docs/doc[@for="IScanner.ScanTokenAndProvideInfoAboutIt"]/*' />
        /// <summary>
        /// Scan the next token and fill in syntax coloring details about it in tokenInfo.
        /// </summary>
        /// <param name="tokenInfo">Keeps information about token.</param>
        /// <param name="state">Keeps track of scanner state. In: state after last token. Out: state after current token.</param>
        /// <returns></returns>
        bool ScanTokenAndProvideInfoAboutIt(TokenInfo tokenInfo, ref int state);
    }
    /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor"]/*' />
    public enum TokenColor {
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor.Text"]/*' />
        Text,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor.Keyword"]/*' />
        Keyword,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor.Comment"]/*' />
        Comment,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor.Identifier"]/*' />
        Identifier,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor.String"]/*' />
        String,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenColor.Number"]/*' />
        Number
    }
    /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo"]/*' />
    public class TokenInfo {
        int startIndex;
        int endIndex;
        TokenColor color;
        TokenType type;
        TokenTriggers trigger;
        int token;

        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.StartIndex;"]/*' />
        public int StartIndex {
            get { return this.startIndex; }
            set { this.startIndex = value; }
        }
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.EndIndex;"]/*' />
        public int EndIndex {
            get { return this.endIndex; }
            set { this.endIndex = value; }
        }
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.Color;"]/*' />
        public TokenColor Color {
            get { return this.color; }
            set { this.color = value; }
        }
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.Type;"]/*' />
        public TokenType Type {
            get { return this.type; }
            set { this.type = value; }
        }
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.Trigger;"]/*' />
        public TokenTriggers Trigger {
            get { return this.trigger; }
            set { this.trigger = value; }
        }

        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.StartIndex;"]/*' />
        /// <summary>Language Specific</summary>
        public int Token {
            get { return token; }
            set { token = value; }
        }
        
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.TokenInfo"]/*' />
        public TokenInfo() { }
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenInfo.TokenInfo1"]/*' />
        public TokenInfo(int startIndex, int endIndex, TokenType type) { this.startIndex = startIndex; this.endIndex = endIndex; this.type = type; }
    }

    /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers"]/*' />
    /// <summary>
    /// TokenTriggers:
    /// If a character has (a) trigger(s) associated with it, it may
    /// fire one or both of the following triggers:
    /// MemberSelect - a member selection tip window
    /// MatchBraces - highlight matching braces
    /// or the following trigger:
    /// MethodTip - a method tip window
    ///     
    /// The following triggers exist for speed reasons: the (fast) lexer 
    /// determines when a (slow) parse might be needed. 
    /// The Trigger.MethodTip trigger is subdivided in 4 
    /// other triggers. It is the best to be as specific as possible;
    /// it is better to return Trigger.ParamStart than Trigger.Param
    /// (or Trigger.MethodTip) 
    /// </summary>
    [FlagsAttribute]
    public enum TokenTriggers {
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.None"]/*' />
        None = 0x00,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.MemberSelect"]/*' />
        MemberSelect = 0x01,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.MatchBraces"]/*' />
        MatchBraces = 0x02,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.MethodTip"]/*' />
        MethodTip = 0xF0,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.ParamStart"]/*' />
        ParameterStart = 0x10,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.ParamNext"]/*' />
        ParameterNext = 0x20,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.ParamEnd"]/*' />
        ParameterEnd = 0x40,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenTriggers.Param"]/*' />
        Parameter = 0x80
    }

    /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType"]/*' />
    public enum TokenType {
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Unknown"]/*' />
        Unknown,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Text"]/*' />
        Text,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Keyword"]/*' />
        Keyword,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Identifier"]/*' />
        Identifier,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.String"]/*' />
        String,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Literal"]/*' />
        Literal,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Operator"]/*' />
        Operator,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Delimiter"]/*' />
        Delimiter,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.WhiteSpace"]/*' />
        WhiteSpace,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.LineComment"]/*' />
        LineComment,
        /// <include file='doc\Scanner.uex' path='docs/doc[@for="TokenType.Comment"]/*' />
        Comment,
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.