RetroArch
ScanContext.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013 LunarG, Inc.
3 //
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 //
10 // Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following
15 // disclaimer in the documentation and/or other materials provided
16 // with the distribution.
17 //
18 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
19 // contributors may be used to endorse or promote products derived
20 // from this software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 // POSSIBILITY OF SUCH DAMAGE.
34 //
35 
36 #ifndef _MACHINE_INDEPENDENT_SCAN_CONTEXT_H
37 #define _MACHINE_INDEPENDENT_SCAN_CONTEXT_H
38 
39 //
40 // This holds context specific to the GLSL scanner, which
41 // sits between the preprocessor scanner and parser.
42 //
43 
44 #pragma once
45 
46 #include "ParseHelper.h"
47 
48 namespace glslang {
49 
50 class TPpContext;
51 class TPpToken;
52 class TParserToken;
53 
54 class TScanContext {
55 public:
57  _parseContext(pc),
59  field(false) { }
60  virtual ~TScanContext() { }
61 
62  static void fillInKeywordMap();
63  static void deleteKeywordMap();
64 
66 
67 protected:
70 
71  int tokenizeIdentifier();
72  int identifierOrType();
73  int reservedWord();
76  int nonreservedKeyword(int esVersion, int nonEsVersion);
77  int precisionKeyword();
78  int matNxM();
79  int dMat();
80  int firstGenerationImage(bool inEs310);
82 
84  bool afterType; // true if we've recognized a type, so can only be looking for an identifier
85  bool afterStruct; // true if we've recognized the STRUCT keyword, so can only be looking for an identifier
86  bool field; // true if we're on a field, right after a '.'
90 
91  const char* tokenText;
92  int keyword;
93 };
94 
95 } // end namespace glslang
96 
97 #endif
Definition: PpContext.h:189
TPpToken * ppToken
Definition: ScanContext.h:89
Definition: PpContext.h:94
Definition: Scan.cpp:280
const char * tokenText
Definition: ScanContext.h:91
Definition: Common.h:231
int identifierOrType()
Definition: Scan.cpp:1514
int dMat()
Definition: Scan.cpp:1617
Definition: ParseHelper.h:75
int matNxM()
Definition: Scan.cpp:1604
int nonreservedKeyword(int esVersion, int nonEsVersion)
Definition: Scan.cpp:1580
bool afterType
Definition: ScanContext.h:84
TSourceLoc loc
Definition: ScanContext.h:87
TParserToken * parserToken
Definition: ScanContext.h:88
TParseContextBase & _parseContext
Definition: ScanContext.h:83
int secondGenerationImage()
Definition: Scan.cpp:1657
version
Definition: setup.py:6
int es30ReservedFromGLSL(int version)
Definition: Scan.cpp:1561
int precisionKeyword()
Definition: Scan.cpp:1593
char reserved[128]
Definition: scefiber.c:17
int identifierOrReserved(bool reserved)
Definition: Scan.cpp:1545
bool afterStruct
Definition: ScanContext.h:85
static void deleteKeywordMap()
Definition: Scan.cpp:714
Definition: ScanContext.h:54
Definition: arrays.h:46
int tokenizeIdentifier()
Definition: Scan.cpp:824
bool field
Definition: ScanContext.h:86
int reservedWord()
Definition: Scan.cpp:1537
TScanContext(TParseContextBase &pc)
Definition: ScanContext.h:56
int keyword
Definition: ScanContext.h:92
TScanContext & operator=(TScanContext &)
#define false
Definition: ordinals.h:83
virtual ~TScanContext()
Definition: ScanContext.h:60
static void fillInKeywordMap()
Definition: Scan.cpp:311
int firstGenerationImage(bool inEs310)
Definition: Scan.cpp:1636
int tokenize(TPpContext *, TParserToken &)
Definition: Scan.cpp:724