Changeset 1412


Ignore:
Timestamp:
May 24, 2012, 9:16:51 AM (8 years ago)
Author:
sam
Message:

test: add most of the GLSL grammar.

Location:
trunk/test/sandbox/lex
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/sandbox/lex/lolfx.l

    r1411 r1412  
    6767"left_op"                    { return GT_LEFT_OP; }
    6868"right_op"                   { return GT_RIGHT_OP; }
    69 "inc_op"                     { return GT_INC_OP; }
    70 "dec_op"                     { return GT_DEC_OP; }
    71 "le_op"                      { return GT_LE_OP; }
    72 "ge_op"                      { return GT_GE_OP; }
    73 "eq_op"                      { return GT_EQ_OP; }
    74 "ne_op"                      { return GT_NE_OP; }
    7569"and_op"                     { return GT_AND_OP; }
    7670"or_op"                      { return GT_OR_OP; }
     
    518512  */
    519513
     514"++"                    { return T_INC; }
     515"--"                    { return T_DEC; }
     516"<="                    { return T_LE; }
     517">="                    { return T_GE; }
     518"=="                    { return T_EQ; }
     519"!="                    { return T_NE; }
     520"<<"                    { return T_LEFT; }
     521">>"                    { return T_RIGHT; }
     522"&&"                    { return T_AND; }
     523"||"                    { return T_OR; }
     524"^^"                    { return T_XOR; }
     525
     526"*="                    { return T_MULEQ; }
     527"/="                    { return T_DIVEQ; }
     528"%="                    { return T_MODEQ; }
     529"+="                    { return T_ADDEQ; }
     530"-="                    { return T_SUBEQ; }
     531"<<="                   { return T_LEFTEQ; }
     532">>="                   { return T_RIGHTEQ; }
     533"&="                    { return T_ANDEQ; }
     534"^="                    { return T_XOREQ; }
     535"|="                    { return T_OREQ; }
     536
    520537[0-9]+\.[0-9]+ { yylval.fval = atof(yytext); return FLOAT; }
    521538[0-9]+         { yylval.ival = atoi(yytext); return INT; }
  • trunk/test/sandbox/lex/lolfx.y

    r1411 r1412  
    7373  */
    7474
    75 %token HT_APPENDSTRUCTUREDBUFFER HT_ASM HT_ASM_FRAGMENT HT_BLENDSTATE HT_BOOL
    76 %token HT_BREAK HT_BUFFER HT_BYTEADDRESSBUFFER HT_CBUFFER HT_CENTROID
    77 %token HT_COLUMN_MAJOR HT_COMPILE HT_COMPILE_FRAGMENT HT_COMPILESHADER HT_CONST
    78 %token HT_CONTINUE HT_COMPUTESHADER HT_CONSUMESTRUCTUREDBUFFER
    79 %token HT_DEPTHSTENCILSTATE HT_DEPTHSTENCILVIEW HT_DISCARD HT_DO HT_DOUBLE
    80 %token HT_DOMAINSHADER HT_DWORD HT_ELSE HT_EXTERN HT_FALSE HT_FLOAT HT_FOR
    81 %token HT_FXGROUP HT_GEOMETRYSHADER HT_GROUPSHARED HT_HALF HT_HULLSHADER HT_IF
    82 %token HT_IN HT_INLINE HT_INOUT HT_INPUTPATCH HT_INT HT_INTERFACE HT_LINE
     75%token HT_APPENDSTRUCTUREDBUFFER HT_ASM HT_ASM_FRAGMENT HT_BLENDSTATE
     76%token HT_BUFFER HT_BYTEADDRESSBUFFER HT_CBUFFER
     77%token HT_COLUMN_MAJOR HT_COMPILE HT_COMPILE_FRAGMENT HT_COMPILESHADER
     78%token HT_COMPUTESHADER HT_CONSUMESTRUCTUREDBUFFER
     79%token HT_DEPTHSTENCILSTATE HT_DEPTHSTENCILVIEW
     80%token HT_DOMAINSHADER HT_DWORD HT_EXTERN HT_FALSE
     81%token HT_FXGROUP HT_GEOMETRYSHADER HT_GROUPSHARED HT_HALF HT_HULLSHADER
     82%token HT_INLINE HT_INPUTPATCH HT_INTERFACE HT_LINE
    8383%token HT_LINEADJ HT_LINEAR HT_LINESTREAM HT_MATRIX HT_NAMESPACE
    84 %token HT_NOINTERPOLATION HT_NOPERSPECTIVE HT_NULL HT_OUT HT_OUTPUTPATCH
     84%token HT_NOINTERPOLATION HT_NULL HT_OUTPUTPATCH
    8585%token HT_PACKOFFSET HT_PASS HT_PIXELFRAGMENT HT_PIXELSHADER HT_POINT
    8686%token HT_POINTSTREAM HT_PRECISE HT_RASTERIZERSTATE HT_RENDERTARGETVIEW
    87 %token HT_RETURN HT_REGISTER HT_ROW_MAJOR HT_RWBUFFER HT_RWBYTEADDRESSBUFFER
     87%token HT_REGISTER HT_ROW_MAJOR HT_RWBUFFER HT_RWBYTEADDRESSBUFFER
    8888%token HT_RWSTRUCTUREDBUFFER HT_RWTEXTURE1D HT_RWTEXTURE1DARRAY HT_RWTEXTURE2D
    89 %token HT_RWTEXTURE2DARRAY HT_RWTEXTURE3D HT_SAMPLER HT_SAMPLER1D HT_SAMPLER2D
    90 %token HT_SAMPLER3D HT_SAMPLERCUBE HT_SAMPLER_STATE HT_SAMPLERSTATE
     89%token HT_RWTEXTURE2DARRAY HT_RWTEXTURE3D HT_SAMPLER
     90%token HT_SAMPLER_STATE HT_SAMPLERSTATE
    9191%token HT_SAMPLERCOMPARISONSTATE HT_SHARED HT_SNORM HT_STATEBLOCK
    92 %token HT_STATEBLOCK_STATE HT_STATIC HT_STRING HT_STRUCT HT_SWITCH
     92%token HT_STATEBLOCK_STATE HT_STATIC HT_STRING
    9393%token HT_STRUCTUREDBUFFER HT_TBUFFER HT_TECHNIQUE HT_TECHNIQUE10
    9494%token HT_TECHNIQUE11XZ HT_TEXTURE HT_TEXTURE1D HT_TEXTURE1DARRAY HT_TEXTURE2D
    9595%token HT_TEXTURE2DARRAY HT_TEXTURE2DMS HT_TEXTURE2DMSARRAY HT_TEXTURE3D
    9696%token HT_TEXTURECUBE HT_TEXTURECUBEARRAY HT_TRUE HT_TYPEDEF HT_TRIANGLE
    97 %token HT_TRIANGLEADJ HT_TRIANGLESTREAM HT_UNIFORM HT_UNORM HT_UINT HT_VECTOR
    98 %token HT_VERTEXFRAGMENT HT_VERTEXSHADER HT_VOID HT_VOLATILE HT_WHILE
     97%token HT_TRIANGLEADJ HT_TRIANGLESTREAM HT_UNORM HT_VECTOR
     98%token HT_VERTEXFRAGMENT HT_VERTEXSHADER HT_VOLATILE
    9999
    100100 /*
     
    145145  */
    146146
    147 %token HT_AUTO HT_CASE HT_CATCH HT_CHAR HT_CLASS HT_CONST_CAST HT_DEFAULT
     147%token HT_AUTO HT_CATCH HT_CHAR HT_CLASS HT_CONST_CAST
    148148%token HT_DELETE HT_DYNAMIC_CAST HT_ENUM HT_EXPLICIT HT_FRIEND HT_GOTO HT_LONG
    149149%token HT_MUTABLE HT_NEW HT_OPERATOR HT_PRIVATE HT_PROTECTED HT_PUBLIC
     
    151151%token HT_TEMPLATE HT_THIS HT_THROW HT_TRY HT_TYPENAME HT_UNION HT_UNSIGNED
    152152%token HT_USING HT_VIRTUAL
     153
     154 /*
     155  * Language keywords
     156  */
     157
     158%token T_INC T_DEC T_LE T_GE T_EQ T_NE T_LEFT T_RIGHT T_AND T_OR T_XOR
     159%token T_MULEQ T_DIVEQ T_MODEQ T_ADDEQ T_SUBEQ T_LEFTEQ T_RIGHTEQ T_ANDEQ
     160%token T_XOREQ T_OREQ
    153161
    154162 /*
     
    208216    | NAME '[' INT ']' '=' NAME ';'
    209217    | NAME '[' INT ']' '=' INT ';'
     218    ;
     219
     220 /*
     221  * Grammar for GLSL
     222  */
     223
     224glsl_variable_identifier:
     225    GLSL_IDENTIFIER
     226    ;
     227
     228glsl_primary_expression:
     229    glsl_variable_identifier
     230    | INTCONSTANT
     231    | UINTCONSTANT
     232    | FLOATCONSTANT
     233    | BOOLCONSTANT
     234    | '(' glsl_expression ')'
     235    ;
     236
     237glsl_postfix_expression:
     238    glsl_primary_expression
     239    | glsl_postfix_expression '[' glsl_integer_expression ']'
     240    | glsl_function_call
     241    | glsl_postfix_expression '.' FIELD_SELECTION
     242    | glsl_postfix_expression T_INC
     243    | glsl_postfix_expression T_DEC
     244    ;
     245
     246glsl_integer_expression:
     247    glsl_expression
     248    ;
     249
     250glsl_function_call:
     251    glsl_function_call_or_method
     252    ;
     253
     254glsl_function_call_or_method:
     255    glsl_function_call_generic
     256    | glsl_postfix_expression '.' glsl_function_call_generic
     257    ;
     258
     259glsl_function_call_generic:
     260    glsl_function_call_header_with_parameters ')'
     261    | glsl_function_call_header_no_parameters ')'
     262    ;
     263
     264glsl_function_call_header_no_parameters:
     265    glsl_function_call_header GHT_VOID
     266    | glsl_function_call_header
     267    ;
     268
     269glsl_function_call_header_with_parameters:
     270    glsl_function_call_header glsl_assignment_expression
     271    | glsl_function_call_header_with_parameters ',' glsl_assignment_expression
     272    ;
     273
     274glsl_function_call_header:
     275    glsl_function_identifier '('
     276    ;
     277
     278glsl_function_identifier:
     279    glsl_type_specifier
     280    | IDENTIFIER
     281    | FIELD_SELECTION
     282    ;
     283
     284glsl_unary_expression:
     285    glsl_postfix_expression
     286    | T_INC glsl_unary_expression
     287    | T_DEC glsl_unary_expression
     288    | glsl_unary_operator glsl_unary_expression
     289    ;
     290
     291glsl_unary_operator:
     292    '+'
     293    | '-'
     294    | '!'
     295    | '~'
     296    ;
     297
     298glsl_multiplicative_expression:
     299    glsl_unary_expression
     300    | glsl_multiplicative_expression '*' glsl_unary_expression
     301    | glsl_multiplicative_expression '/' glsl_unary_expression
     302    | glsl_multiplicative_expression '%' glsl_unary_expression
     303    ;
     304
     305glsl_additive_expression:
     306    glsl_multiplicative_expression
     307    | glsl_additive_expression '+' glsl_multiplicative_expression
     308    | glsl_additive_expression '-' glsl_multiplicative_expression
     309    ;
     310
     311glsl_shift_expression:
     312    glsl_additive_expression
     313    | glsl_shift_expression T_LEFT glsl_additive_expression
     314    | glsl_shift_expression T_RIGHT glsl_additive_expression
     315    ;
     316
     317glsl_relational_expression:
     318    glsl_shift_expression
     319    | glsl_relational_expression '<' glsl_shift_expression
     320    | glsl_relational_expression '>' glsl_shift_expression
     321    | glsl_relational_expression T_LE glsl_shift_expression
     322    | glsl_relational_expression T_GE glsl_shift_expression
     323    ;
     324
     325glsl_equality_expression:
     326    glsl_relational_expression
     327    | glsl_equality_expression T_EQ glsl_relational_expression
     328    | glsl_equality_expression T_NE glsl_relational_expression
     329    ;
     330
     331glsl_and_expression:
     332    glsl_equality_expression
     333    | glsl_and_expression '&' glsl_equality_expression
     334    ;
     335
     336glsl_exclusive_or_expression:
     337    glsl_and_expression
     338    | glsl_exclusive_or_expression '^' glsl_and_expression
     339    ;
     340
     341glsl_inclusive_or_expression:
     342    glsl_exclusive_or_expression
     343    | glsl_inclusive_or_expression '|' glsl_exclusive_or_expression
     344    ;
     345
     346glsl_logical_and_expression:
     347    glsl_inclusive_or_expression
     348    | glsl_logical_and_expression T_AND glsl_inclusive_or_expression
     349    ;
     350
     351glsl_logical_xor_expression:
     352    glsl_logical_and_expression
     353    | glsl_logical_xor_expression T_XOR glsl_logical_and_expression
     354    ;
     355
     356glsl_logical_or_expression:
     357    glsl_logical_xor_expression
     358    | glsl_logical_or_expression T_OR glsl_logical_xor_expression
     359    ;
     360
     361glsl_conditional_expression:
     362    glsl_logical_or_expression
     363    | glsl_logical_or_expression '?' glsl_expression ':' glsl_assignment_expression
     364    ;
     365
     366glsl_assignment_expression:
     367    glsl_conditional_expression
     368    | glsl_unary_expression glsl_assignment_operator glsl_assignment_expression
     369    ;
     370
     371glsl_assignment_operator:
     372    '='
     373    | T_MULEQ
     374    | T_DIVEQ
     375    | T_MODEQ
     376    | T_ADDEQ
     377    | T_SUBEQ
     378    | T_LEFTEQ
     379    | T_RIGHTEQ
     380    | T_ANDEQ
     381    | T_XOREQ
     382    | T_OREQ
     383    ;
     384
     385glsl_expression:
     386    glsl_assignment_expression
     387    | glsl_expression ',' glsl_assignment_expression
     388    ;
     389
     390glsl_constant_expression:
     391    glsl_conditional_expression
     392    ;
     393
     394glsl_declaration:
     395    glsl_function_prototype ';'
     396    | glsl_init_declarator_list ';'
     397    | PRECISION glsl_precision_qualifier glsl_type_specifier_no_prec ';'
     398    | glsl_type_qualifier IDENTIFIER '{' glsl_struct_declaration_list '}' ';'
     399    | glsl_type_qualifier IDENTIFIER '{' glsl_struct_declaration_list '}' IDENTIFIER ';'
     400    | glsl_type_qualifier IDENTIFIER '{' glsl_struct_declaration_list '}' IDENTIFIER '[' ']' ';'
     401    | glsl_type_qualifier IDENTIFIER '{' glsl_struct_declaration_list '}' IDENTIFIER '[' glsl_constant_expression ']' ';'
     402    | glsl_type_qualifier ';'
     403    ;
     404
     405glsl_function_prototype:
     406    glsl_function_declarator ')'
     407    ;
     408
     409glsl_function_declarator:
     410    glsl_function_header
     411    | glsl_function_header_with_parameters
     412    ;
     413
     414glsl_function_header_with_parameters:
     415    glsl_function_header glsl_parameter_declaration
     416    | glsl_function_header_with_parameters ',' glsl_parameter_declaration
     417    ;
     418
     419glsl_function_header:
     420    glsl_fully_specified_type IDENTIFIER '('
     421    ;
     422
     423glsl_parameter_declarator:
     424    glsl_type_specifier IDENTIFIER
     425    | glsl_type_specifier IDENTIFIER '[' glsl_constant_expression ']'
     426    ;
     427
     428glsl_parameter_declaration:
     429    glsl_parameter_type_qualifier glsl_parameter_qualifier glsl_parameter_declarator
     430    | glsl_parameter_qualifier glsl_parameter_declarator
     431    | glsl_parameter_type_qualifier glsl_parameter_qualifier glsl_parameter_type_specifier
     432    | glsl_parameter_qualifier glsl_parameter_type_specifier
     433    ;
     434
     435glsl_parameter_qualifier:
     436    /* empty */
     437    | GHT_IN
     438    | GHT_OUT
     439    | GHT_INOUT
     440    ;
     441
     442glsl_parameter_type_specifier:
     443    glsl_type_specifier
     444    ;
     445
     446glsl_init_declarator_list:
     447    glsl_single_declaration
     448    | glsl_init_declarator_list ',' IDENTIFIER
     449    | glsl_init_declarator_list ',' IDENTIFIER '[' ']'
     450    | glsl_init_declarator_list ',' IDENTIFIER '[' glsl_constant_expression ']'
     451    | glsl_init_declarator_list ',' IDENTIFIER '[' ']' '=' glsl_initializer
     452    | glsl_init_declarator_list ',' IDENTIFIER '[' glsl_constant_expression ']' '=' glsl_initializer
     453    | glsl_init_declarator_list ',' IDENTIFIER '=' glsl_initializer
     454    ;
     455
     456glsl_single_declaration:
     457    glsl_fully_specified_type
     458    | glsl_fully_specified_type IDENTIFIER
     459    | glsl_fully_specified_type IDENTIFIER '[' ']'
     460    | glsl_fully_specified_type IDENTIFIER '[' glsl_constant_expression ']'
     461    | glsl_fully_specified_type IDENTIFIER '[' ']' '=' glsl_initializer
     462    | glsl_fully_specified_type IDENTIFIER '[' glsl_constant_expression ']' '=' glsl_initializer
     463    | glsl_fully_specified_type IDENTIFIER '=' glsl_initializer
     464    | INVARIANT IDENTIFIER
     465    ;
     466
     467glsl_fully_specified_type:
     468    glsl_type_specifier
     469    | glsl_type_qualifier glsl_type_specifier
     470    ;
     471
     472glsl_invariant_qualifier:
     473    INVARIANT
     474    ;
     475
     476glsl_interpolation_qualifier:
     477    GT_SMOOTH
     478    | GT_FLAT
     479    | GHT_NOPERSPECTIVE
     480    ;
     481
     482glsl_layout_qualifier:
     483    GT_LAYOUT '(' glsl_layout_qualifier_id_list ')'
     484    ;
     485
     486glsl_layout_qualifier_id_list:
     487    glsl_layout_qualifier_id
     488    | glsl_layout_qualifier_id_list ',' glsl_layout_qualifier_id
     489    ;
     490
     491glsl_layout_qualifier_id:
     492    IDENTIFIER
     493    | IDENTIFIER '=' INTCONSTANT
     494    ;
     495
     496glsl_parameter_type_qualifier:
     497    GHT_CONST
     498    ;
     499
     500glsl_type_qualifier:
     501    glsl_storage_qualifier
     502    | glsl_layout_qualifier
     503    | glsl_layout_qualifier glsl_storage_qualifier
     504    | glsl_interpolation_qualifier glsl_storage_qualifier
     505    | glsl_interpolation_qualifier
     506    | glsl_invariant_qualifier glsl_storage_qualifier
     507    | glsl_invariant_qualifier glsl_interpolation_qualifier glsl_storage_qualifier
     508    | glsl_invariant_qualifier
     509    ;
     510
     511glsl_storage_qualifier:
     512    GHT_CONST
     513    | GHT_IN
     514    | GHT_OUT
     515    | GHT_CENTROID GHT_IN
     516    | GHT_CENTROID GHT_OUT
     517    | GT_PATCH GHT_IN
     518    | GT_PATCH GHT_OUT
     519    | GT_SAMPLE GHT_IN
     520    | GT_SAMPLE GHT_OUT
     521    | GHT_UNIFORM
     522    ;
     523
     524glsl_type_specifier:
     525    glsl_type_specifier_no_prec
     526    | glsl_precision_qualifier glsl_type_specifier_no_prec
     527    ;
     528
     529glsl_type_specifier_no_prec:
     530    glsl_type_specifier_nonarray
     531    | glsl_type_specifier_nonarray '[' ']'
     532    | glsl_type_specifier_nonarray '[' glsl_constant_expression ']'
     533
     534glsl_type_specifier_nonarray:
     535    GHT_VOID
     536    | GHT_FLOAT
     537    | GHT_DOUBLE
     538    | GHT_INT
     539    | GHT_UINT
     540    | GHT_BOOL
     541    | GT_VEC2
     542    | GT_VEC3
     543    | GT_VEC4
     544    | GT_DVEC2
     545    | GT_DVEC3
     546    | GT_DVEC4
     547    | GT_BVEC2
     548    | GT_BVEC3
     549    | GT_BVEC4
     550    | GT_IVEC2
     551    | GT_IVEC3
     552    | GT_IVEC4
     553    | GT_UVEC2
     554    | GT_UVEC3
     555    | GT_UVEC4
     556    | GT_MAT2
     557    | GT_MAT3
     558    | GT_MAT4
     559    | GT_MAT2X2
     560    | GT_MAT2X3
     561    | GT_MAT2X4
     562    | GT_MAT3X2
     563    | GT_MAT3X3
     564    | GT_MAT3X4
     565    | GT_MAT4X2
     566    | GT_MAT4X3
     567    | GT_MAT4X4
     568    | GT_DMAT2
     569    | GT_DMAT3
     570    | GT_DMAT4
     571    | GT_DMAT2X2
     572    | GT_DMAT2X3
     573    | GT_DMAT2X4
     574    | GT_DMAT3X2
     575    | GT_DMAT3X3
     576    | GT_DMAT3X4
     577    | GT_DMAT4X2
     578    | GT_DMAT4X3
     579    | GT_DMAT4X4
     580    | GHT_SAMPLER1D
     581    | GHT_SAMPLER2D
     582    | GHT_SAMPLER3D
     583    | GHT_SAMPLERCUBE
     584    | GT_SAMPLER1DSHADOW
     585    | GT_SAMPLER2DSHADOW
     586    | GT_SAMPLERCUBESHADOW
     587    | GT_SAMPLER1DARRAY
     588    | GT_SAMPLER2DARRAY
     589    | GT_SAMPLER1DARRAYSHADOW
     590    | GT_SAMPLER2DARRAYSHADOW
     591    | GT_SAMPLERCUBEARRAY
     592    | GT_SAMPLERCUBEARRAYSHADOW
     593    | GT_ISAMPLER1D
     594    | GT_ISAMPLER2D
     595    | GT_ISAMPLER3D
     596    | GT_ISAMPLERCUBE
     597    | GT_ISAMPLER1DARRAY
     598    | GT_ISAMPLER2DARRAY
     599    | GT_ISAMPLERCUBEARRAY
     600    | GT_USAMPLER1D
     601    | GT_USAMPLER2D
     602    | GT_USAMPLER3D
     603    | GT_USAMPLERCUBE
     604    | GT_USAMPLER1DARRAY
     605    | GT_USAMPLER2DARRAY
     606    | GT_USAMPLERCUBEARRAY
     607    | GT_SAMPLER2DRECT
     608    | GT_SAMPLER2DRECTSHADOW
     609    | GT_ISAMPLER2DRECT
     610    | GT_USAMPLER2DRECT
     611    | GT_SAMPLERBUFFER
     612    | GT_ISAMPLERBUFFER
     613    | GT_USAMPLERBUFFER
     614    | GT_SAMPLER2DMS
     615    | GT_ISAMPLER2DMS
     616    | GT_USAMPLER2DMS
     617    | GT_SAMPLER2DMSARRAY
     618    | GT_ISAMPLER2DMSARRAY
     619    | GT_USAMPLER2DMSARRAY
     620    | glsl_struct_specifier
     621    | TYPE_NAME
     622    ;
     623
     624glsl_precision_qualifier:
     625    HIGH_PRECISION
     626    | MEDIUM_PRECISION
     627    | LOW_PRECISION
     628    ;
     629
     630glsl_struct_specifier:
     631    GHT_STRUCT IDENTIFIER '{' glsl_struct_declaration_list '}'
     632    | GHT_STRUCT '{' glsl_struct_declaration_list '}'
     633    ;
     634
     635glsl_struct_declaration_list:
     636    glsl_struct_declaration
     637    | glsl_struct_declaration_list glsl_struct_declaration
     638    ;
     639
     640glsl_struct_declaration:
     641    glsl_type_specifier glsl_struct_declarator_list ';'
     642    | glsl_type_qualifier glsl_type_specifier glsl_struct_declarator_list ';'
     643    ;
     644
     645glsl_struct_declarator_list:
     646    glsl_struct_declarator
     647    | glsl_struct_declarator_list ',' glsl_struct_declarator
     648    ;
     649
     650glsl_struct_declarator:
     651    IDENTIFIER
     652    | IDENTIFIER '[' ']'
     653    | IDENTIFIER '[' glsl_constant_expression ']'
     654    ;
     655
     656glsl_initializer:
     657    glsl_assignment_expression
     658    ;
     659
     660glsl_declaration_statement:
     661    glsl_declaration
     662    ;
     663
     664glsl_statement:
     665    glsl_compound_statement
     666    | glsl_simple_statement
     667    ;
     668
     669glsl_simple_statement:
     670    glsl_declaration_statement
     671    | glsl_expression_statement
     672    | glsl_selection_statement
     673    | glsl_switch_statement
     674    | glsl_case_label
     675    | glsl_iteration_statement
     676    | glsl_jump_statement
     677    ;
     678
     679glsl_compound_statement:
     680    '{' '}'
     681    | '{' glsl_statement_list '}'
     682    ;
     683
     684glsl_statement_no_new_scope:
     685    glsl_compound_statement_no_new_scope
     686    | glsl_simple_statement
     687    ;
     688
     689glsl_compound_statement_no_new_scope:
     690    '{' '}'
     691    | '{' glsl_statement_list '}'
     692    ;
     693
     694glsl_statement_list:
     695    glsl_statement
     696    | glsl_statement_list glsl_statement
     697    ;
     698
     699glsl_expression_statement:
     700    ';'
     701    | glsl_expression ';'
     702    ;
     703
     704glsl_selection_statement:
     705    GHT_IF '(' glsl_expression ')' glsl_selection_rest_statement
     706    ;
     707
     708glsl_selection_rest_statement:
     709    glsl_statement GHT_ELSE glsl_statement
     710    | glsl_statement
     711    ;
     712
     713glsl_condition:
     714    glsl_expression
     715    | glsl_fully_specified_type IDENTIFIER '=' glsl_initializer
     716    ;
     717
     718glsl_switch_statement:
     719    GHT_SWITCH '(' glsl_expression ')' '{' glsl_switch_statement_list '}'
     720    ;
     721
     722glsl_switch_statement_list:
     723    /* nothing */
     724    | glsl_statement_list
     725    ;
     726
     727glsl_case_label:
     728    GHT_CASE glsl_expression ':'
     729    | GHT_DEFAULT ':'
     730    ;
     731
     732glsl_iteration_statement:
     733    GHT_WHILE '(' glsl_condition ')' glsl_statement_no_new_scope
     734    | GHT_DO glsl_statement GHT_WHILE '(' glsl_expression ')' ';'
     735    | GHT_FOR '(' glsl_for_init_statement glsl_for_rest_statement ')' glsl_statement_no_new_scope
     736    ;
     737
     738glsl_for_init_statement:
     739    glsl_expression_statement
     740    | glsl_declaration_statement
     741    ;
     742
     743glsl_conditionopt:
     744    glsl_condition
     745    | /* empty */
     746    ;
     747
     748glsl_for_rest_statement:
     749    glsl_conditionopt ';'
     750    | glsl_conditionopt ';' glsl_expression
     751    ;
     752
     753glsl_jump_statement:
     754    GHT_CONTINUE ';'
     755    | GHT_BREAK ';'
     756    | GHT_RETURN ';'
     757    | GHT_RETURN glsl_expression ';'
     758    | GHT_DISCARD ';'
     759    ;
     760
     761glsl_translation_unit:
     762    glsl_external_declaration
     763    glsl_translation_unit glsl_external_declaration
     764    ;
     765
     766glsl_external_declaration:
     767    glsl_function_definition
     768    | glsl_declaration
     769    ;
     770
     771glsl_function_definition:
     772    glsl_function_prototype glsl_compound_statement_no_new_scope
    210773    ;
    211774
Note: See TracChangeset for help on using the changeset viewer.