diff options
Diffstat (limited to 'Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h')
-rw-r--r-- | Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h b/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h index cb6e0d0..3e05763 100644 --- a/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h +++ b/Source/ThirdParty/ANGLE/src/compiler/ParseHelper.h @@ -30,34 +30,58 @@ struct TPragma { // they can be passed to the parser without needing a global. // struct TParseContext { - TParseContext(TSymbolTable& symt, const TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, TInfoSink& is) : - intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), treeRoot(0), - recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0), - inTypeParen(false), scanner(NULL), contextPragma(true, false) { } + TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) : + intermediate(interm), + symbolTable(symt), + extensionBehavior(ext), + infoSink(is), + shaderType(type), + shaderSpec(spec), + compileOptions(options), + sourcePath(sourcePath), + treeRoot(0), + numErrors(0), + lexAfterType(false), + loopNestingLevel(0), + structNestingLevel(0), + inTypeParen(false), + currentFunctionType(NULL), + functionReturnsValue(false), + checksPrecisionErrors(checksPrecErrors), + contextPragma(true, false), + scanner(NULL) { } TIntermediate& intermediate; // to hold and build a parse tree TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed - TExtensionBehavior extensionBehavior; // mapping between supported extensions and current behavior. + TExtensionBehavior& extensionBehavior; // mapping between supported extensions and current behavior. TInfoSink& infoSink; ShShaderType shaderType; // vertex or fragment language (future: pack or unpack) ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL. + int compileOptions; + const char* sourcePath; // Path of source file or NULL. TIntermNode* treeRoot; // root of parse tree being created - bool recoveredFromError; // true if a parse error has occurred, but we continue to parse int numErrors; bool lexAfterType; // true if we've recognized a type, so can only be looking for an identifier int loopNestingLevel; // 0 if outside all loops + int structNestingLevel; // incremented while parsing a struct declaration bool inTypeParen; // true if in parentheses, looking only for an identifier const TType* currentFunctionType; // the return type of the function that's currently being parsed bool functionReturnsValue; // true if a non-void function has a return + bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit. + struct TPragma contextPragma; + TString HashErrMsg; + bool AfterEOF; + void* scanner; void error(TSourceLoc loc, const char *reason, const char* token, const char* extraInfoFormat, ...); void warning(TSourceLoc loc, const char* reason, const char* token, const char* extraInfoFormat, ...); - bool reservedErrorCheck(int line, const TString& identifier); void recover(); bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line); bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, int line); + + bool reservedErrorCheck(int line, const TString& identifier); void assignError(int line, const char* op, TString left, TString right); void unaryOpError(int line, const char* op, TString operand); void binaryOpError(int line, const char* op, TString left, TString right); @@ -77,15 +101,19 @@ struct TParseContext { bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason); bool structQualifierErrorCheck(int line, const TPublicType& pType); bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type); - bool containsSampler(TType& type); bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type); - bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type); + bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type, TVariable*& variable); bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type); bool extensionErrorCheck(int line, const TString&); + bool supportsExtension(const char* extension); + + bool containsSampler(TType& type); + bool areAllChildConst(TIntermAggregate* aggrNode); const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0); bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType, TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0); - bool areAllChildConst(TIntermAggregate* aggrNode); + bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc); + TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc); TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type); TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset); @@ -94,11 +122,14 @@ struct TParseContext { TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc); TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line); TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc); - bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc); - void* scanner; - struct TPragma contextPragma; - TString HashErrMsg; - bool AfterEOF; + + // Performs an error check for embedded struct declarations. + // Returns true if an error was raised due to the declaration of + // this struct. + bool enterStructDeclaration(TSourceLoc line, const TString& identifier); + void exitStructDeclaration(); + + bool structNestingErrorCheck(TSourceLoc line, const TType& fieldType); }; int PaParseStrings(int count, const char* const string[], const int length[], |