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
9
* You must not remove this notice from this software.
10
* **********************************************************************************/
14
using System.Collections.Generic;
17
using System.Runtime.InteropServices;
19
namespace Irony.CompilerServices {
21
public class TerminalLookupTable : Dictionary<char, TerminalList> { }
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();
34
public ScannerData(GrammarData grammarData) {
35
GrammarData = grammarData;
39
// A struct used for packing/unpacking ScannerState int value; used for VS integration.
40
[StructLayout(LayoutKind.Explicit)]
41
public struct VsScannerStateMap {
45
public byte TerminalIndex; //1-based index of active multiline term in MultilineTerminals
47
public byte TokenSubType; //terminal subtype (used in StringLiteral to identify string kind)
49
public short TerminalFlags; //Terminal flags