~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/Reports/Irony/CompilerServices/Scanner/ScannerData.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
#region License
 
2
/* **********************************************************************************
 
3
 * Copyright (c) Roman Ivantsov
 
4
 * This source code is subject to terms and conditions of the MIT License
 
5
 * for Irony. A copy of the license can be found in the License.txt file
 
6
 * at the root of this distribution. 
 
7
 * By using this source code in any fashion, you are agreeing to be bound by the terms of the 
 
8
 * MIT License.
 
9
 * You must not remove this notice from this software.
 
10
 * **********************************************************************************/
 
11
#endregion
 
12
 
 
13
using System;
 
14
using System.Collections.Generic;
 
15
using System.Linq;
 
16
using System.Text;
 
17
using System.Runtime.InteropServices;
 
18
 
 
19
namespace Irony.CompilerServices {
 
20
 
 
21
  public class TerminalLookupTable : Dictionary<char, TerminalList> { }
 
22
 
 
23
  // ScannerData is a container for all info needed by scanner to read input. 
 
24
  // ScannerData is a field in LanguageData structure and is used by Scanner. 
 
25
  public class ScannerData {
 
26
    public readonly GrammarData GrammarData;
 
27
    public readonly TerminalLookupTable TerminalsLookup = new TerminalLookupTable(); //hash table for fast terminal lookup by input char
 
28
    public readonly TerminalList FallbackTerminals = new TerminalList(); //terminals that have no explicit prefixes
 
29
    public string ScannerRecoverySymbols;
 
30
    public char[] LineTerminators; //used for line counting
 
31
    public readonly TerminalList MultilineTerminals = new TerminalList();
 
32
    public readonly TokenFilterList TokenFilters = new TokenFilterList(); 
 
33
 
 
34
    public ScannerData(GrammarData grammarData) {
 
35
      GrammarData  = grammarData;
 
36
    }
 
37
  }//class
 
38
 
 
39
  // A struct used for packing/unpacking ScannerState int value; used for VS integration.
 
40
  [StructLayout(LayoutKind.Explicit)]
 
41
  public struct VsScannerStateMap {
 
42
    [FieldOffset(0)]
 
43
    public int Value;
 
44
    [FieldOffset(0)]
 
45
    public byte TerminalIndex;   //1-based index of active multiline term in MultilineTerminals
 
46
    [FieldOffset(1)]
 
47
    public byte TokenSubType;         //terminal subtype (used in StringLiteral to identify string kind)
 
48
    [FieldOffset(2)]
 
49
    public short TerminalFlags;  //Terminal flags
 
50
  }//struct
 
51
 
 
52
}//namespace