~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/Reports/Irony/CompilerServices/EditorSupport.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Linq;
 
4
using System.Text;
 
5
 
 
6
namespace Irony.Compiler {
 
7
  // Initial implementation of syntax highlighting in editor. 
 
8
  // TokenColor, TokenTriggers and TokenType are copied from the Visual studio integration assemblies. 
 
9
  //  Each terminal/token would have its TokenEditorInfo that can be used either by VS integration package 
 
10
  //   or any editor for syntax highligting.
 
11
 
 
12
  public class TokenEditorInfo {
 
13
    public readonly TokenType Type;
 
14
    public readonly TokenColor Color;
 
15
    public readonly TokenTriggers Triggers;
 
16
    public TokenEditorInfo(TokenType type, TokenColor color, TokenTriggers triggers) {
 
17
      Type = type;
 
18
      Color = color;
 
19
      Triggers = triggers;
 
20
    }
 
21
 
 
22
  }//class
 
23
 
 
24
  public enum TokenColor {
 
25
    Text = 0,
 
26
    Keyword = 1,
 
27
    Comment = 2,
 
28
    Identifier = 3,
 
29
    String = 4,
 
30
    Number = 5,
 
31
  }
 
32
 
 
33
  // (Comments are coming from visual studio integration package)
 
34
  //     Specifies a set of triggers that can be fired from an Microsoft.VisualStudio.Package.IScanner
 
35
  //     language parser.
 
36
  [Flags]
 
37
  public enum TokenTriggers {
 
38
    // Summary:
 
39
    //     Used when no triggers are set. This is the default.
 
40
    None = 0,
 
41
    //
 
42
    // Summary:
 
43
    //     A character that indicates that the start of a member selection has been
 
44
    //     parsed. In C#, this could be a period following a class name. In XML, this
 
45
    //     could be a < (the member select is a list of possible tags).
 
46
    MemberSelect = 1,
 
47
    //
 
48
    // Summary:
 
49
    //     The opening or closing part of a language pair has been parsed. For example,
 
50
    //     in C#, a { or } has been parsed. In XML, a < or > has been parsed.
 
51
    MatchBraces = 2,
 
52
    //
 
53
    // Summary:
 
54
    //     A character that marks the start of a parameter list has been parsed. For
 
55
    //     example, in C#, this could be an open parenthesis, "(".
 
56
    ParameterStart = 16,
 
57
    //
 
58
    // Summary:
 
59
    //     A character that separates parameters in a list has been parsed. For example,
 
60
    //     in C#, this could be a comma, ",".
 
61
    ParameterNext = 32,
 
62
    //
 
63
    // Summary:
 
64
    //     A character that marks the end of a parameter list has been parsed. For example,
 
65
    //     in C#, this could be a close parenthesis, ")".
 
66
    ParameterEnd = 64,
 
67
    //
 
68
    // Summary:
 
69
    //     A parameter in a method's parameter list has been parsed.
 
70
    Parameter = 128,
 
71
    //
 
72
    // Summary:
 
73
    //     This is a mask for the flags used to govern the IntelliSense Method Tip operation.
 
74
    //     This mask is used to isolate the values Microsoft.VisualStudio.Package.TokenTriggers.Parameter,
 
75
    //     Microsoft.VisualStudio.Package.TokenTriggers.ParameterStart, Microsoft.VisualStudio.Package.TokenTriggers.ParameterNext,
 
76
    //     and Microsoft.VisualStudio.Package.TokenTriggers.ParameterEnd.
 
77
    MethodTip = 240,
 
78
  }
 
79
 
 
80
  public enum TokenType {
 
81
    Unknown = 0,
 
82
    Text = 1,
 
83
    Keyword = 2,
 
84
    Identifier = 3,
 
85
    String = 4,
 
86
    Literal = 5,
 
87
    Operator = 6,
 
88
    Delimiter = 7,
 
89
    WhiteSpace = 8,
 
90
    LineComment = 9,
 
91
    Comment = 10,
 
92
  }
 
93
 
 
94
}