summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/library/slang_shader.syn
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/slang/library/slang_shader.syn')
-rw-r--r--src/mesa/shader/slang/library/slang_shader.syn347
1 files changed, 78 insertions, 269 deletions
diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn
index cc5c70a02f..f6bf7f1e54 100644
--- a/src/mesa/shader/slang/library/slang_shader.syn
+++ b/src/mesa/shader/slang/library/slang_shader.syn
@@ -274,11 +274,11 @@
/* any syntax errors... */
.errtext INVALID_EXTERNAL_DECLARATION "2001: Syntax error."
.errtext INVALID_OPERATOR_OVERRIDE "2002: Invalid operator override."
-.errtext LBRACE_EXPECTED "2003: '{' expected but '$err_token$' found."
-.errtext LPAREN_EXPECTED "2004: '(' expected but '$err_token$' found."
-.errtext RPAREN_EXPECTED "2005: ')' expected but '$err_token$' found."
-.errtext INVALID_PRECISION "2006: Invalid precision specifier '$err_token$'."
-.errtext INVALID_PRECISION_TYPE "2007: Invalid precision type '$err_token$'."
+.errtext LBRACE_EXPECTED "2003: '{' expected but token found."
+.errtext LPAREN_EXPECTED "2004: '(' expected but token found."
+.errtext RPAREN_EXPECTED "2005: ')' expected but token found."
+.errtext INVALID_PRECISION "2006: Invalid precision specifier."
+.errtext INVALID_PRECISION_TYPE "2007: Invalid precision type."
/*
@@ -692,11 +692,7 @@ function_header_with_parameters_1
* <function_header> ::= <fully_specified_type> <identifier> "("
*/
function_header
- function_header_nospace .or function_header_space;
-function_header_space
- fully_specified_type_space .and space .and function_decl_identifier .and lparen;
-function_header_nospace
- fully_specified_type_nospace .and function_decl_identifier .and lparen;
+ fully_specified_type .and function_decl_identifier .and lparen;
/*
* <function_decl_identifier> ::= "__constructor"
@@ -793,11 +789,7 @@ overriden_operator
* | <type_specifier> <identifier> "[" <constant_expression> "]"
*/
parameter_declarator
- parameter_declarator_nospace .or parameter_declarator_space;
-parameter_declarator_nospace
- type_specifier_nospace .and identifier .and parameter_declarator_1;
-parameter_declarator_space
- type_specifier_space .and space .and identifier .and parameter_declarator_1;
+ type_specifier .and identifier .and parameter_declarator_1;
parameter_declarator_1
parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or
.true .emit PARAMETER_ARRAY_NOT_PRESENT;
@@ -825,15 +817,13 @@ parameter_declaration
parameter_declaration_1
parameter_declaration_2 .or parameter_declaration_3;
parameter_declaration_2
- type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;
+ type_qualifier .and parameter_qualifier .and parameter_declaration_4;
parameter_declaration_3
parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;
parameter_declaration_4
parameter_declaration_optprec .and parameter_declaration_rest;
parameter_declaration_optprec
- parameter_declaration_prec .or .true .emit PRECISION_DEFAULT;
-parameter_declaration_prec
- precision .and space;
+ precision .or .true .emit PRECISION_DEFAULT;
parameter_declaration_rest
parameter_declarator .or parameter_type_specifier;
@@ -846,8 +836,6 @@ parameter_declaration_rest
parameter_qualifier
parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;
parameter_qualifier_1
- parameter_qualifier_2 .and space;
-parameter_qualifier_2
"in" .emit PARAM_QUALIFIER_IN .or
"out" .emit PARAM_QUALIFIER_OUT .or
"inout" .emit PARAM_QUALIFIER_INOUT;
@@ -857,9 +845,7 @@ parameter_qualifier_2
* | <type_specifier> "[" <constant_expression> "]"
*/
parameter_type_specifier
- parameter_type_specifier_1 .and .true .emit '\0' .and parameter_type_specifier_2;
-parameter_type_specifier_1
- type_specifier_nospace .or type_specifier_space;
+ type_specifier .and .true .emit '\0' .and parameter_type_specifier_2;
parameter_type_specifier_2
parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or
.true .emit PARAMETER_ARRAY_NOT_PRESENT;
@@ -895,18 +881,10 @@ init_declarator_list_5
* | <fully_specified_type> <identifier> "=" <initializer>
*/
single_declaration
- single_declaration_nospace .or single_declaration_space;
-single_declaration_space
- fully_specified_type_space .and single_declaration_space_1;
-single_declaration_nospace
- fully_specified_type_nospace .and single_declaration_nospace_1;
-single_declaration_space_1
- single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
-single_declaration_nospace_1
- single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
-single_declaration_space_2
- space .and identifier .and single_declaration_3;
-single_declaration_nospace_2
+ fully_specified_type .and single_declaration_1;
+single_declaration_1
+ single_declaration_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
+single_declaration_2
identifier .and single_declaration_3;
single_declaration_3
single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;
@@ -922,26 +900,16 @@ single_declaration_6
*
* Example: "invariant varying highp vec3"
*/
-fully_specified_type_space
- fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space;
-fully_specified_type_nospace
- fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_nospace;
+fully_specified_type
+ fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier;
fully_specified_type_optinvariant
- fully_specified_type_invariant .or .true .emit TYPE_VARIANT;
-fully_specified_type_invariant
- invariant_qualifier .and space;
+ invariant_qualifier .or .true .emit TYPE_VARIANT;
fully_specified_type_optcentroid
- fully_specified_type_centroid .or .true .emit TYPE_CENTER;
-fully_specified_type_centroid
- centroid_qualifier .and space;
+ centroid_qualifier .or .true .emit TYPE_CENTER;
fully_specified_type_optqual
- fully_specified_type_qual .or .true .emit TYPE_QUALIFIER_NONE;
-fully_specified_type_qual
- type_qualifier .and space;
+ type_qualifier .or .true .emit TYPE_QUALIFIER_NONE;
fully_specified_type_optprec
- fully_specified_type_prec .or .true .emit PRECISION_DEFAULT;
-fully_specified_type_prec
- precision .and space;
+ precision .or .true .emit PRECISION_DEFAULT;
/*
* <invariant_qualifier> ::= "invariant"
@@ -1006,7 +974,8 @@ type_qualifier
* | <struct_specifier>
* | <type_name>
*/
-type_specifier_nonarray_space
+type_specifier_nonarray
+ struct_specifier .emit TYPE_SPECIFIER_STRUCT .or
"void" .emit TYPE_SPECIFIER_VOID .or
"float" .emit TYPE_SPECIFIER_FLOAT .or
"int" .emit TYPE_SPECIFIER_INT .or
@@ -1038,22 +1007,16 @@ type_specifier_nonarray_space
"sampler2DRect" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or
"sampler2DRectShadow" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW .or
type_name .emit TYPE_SPECIFIER_TYPENAME;
-type_specifier_nonarray_nospace
- struct_specifier .emit TYPE_SPECIFIER_STRUCT;
-type_specifier_nonarray
- type_specifier_nonarray_nospace .or type_specifier_nonarray_space;
/*
* <type_specifier> ::= <type_specifier_nonarray>
* | <type_specifier_nonarray> "[" <constant_expression> "]"
*/
-type_specifier_space
- type_specifier_nonarray_space .and .true .emit TYPE_SPECIFIER_NONARRAY;
-type_specifier_nospace
- type_specifier_nospace_array .or type_specifier_nospace_1;
-type_specifier_nospace_1
- type_specifier_nonarray_nospace .and .true .emit TYPE_SPECIFIER_NONARRAY;
-type_specifier_nospace_array
+type_specifier
+ type_specifier_array .or type_specifier_1;
+type_specifier_1
+ type_specifier_nonarray .and .true .emit TYPE_SPECIFIER_NONARRAY;
+type_specifier_array
type_specifier_nonarray .and lbracket .emit TYPE_SPECIFIER_ARRAY .and constant_expression .and rbracket;
/*
@@ -1061,12 +1024,10 @@ type_specifier_nospace_array
* | "struct" "{" <struct_declaration_list> "}"
*/
struct_specifier
- "struct" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and
+ "struct" .and struct_specifier_1 .and lbrace .error LBRACE_EXPECTED .and
struct_declaration_list .and rbrace .emit FIELD_NONE;
struct_specifier_1
- struct_specifier_2 .or .true .emit '\0';
-struct_specifier_2
- space .and identifier;
+ identifier .or .true .emit '\0';
/*
* <struct_declaration_list> ::= <struct_declaration>
@@ -1079,11 +1040,7 @@ struct_declaration_list
* <struct_declaration> ::= <type_specifier> <struct_declarator_list> ";"
*/
struct_declaration
- struct_declaration_nospace .or struct_declaration_space;
-struct_declaration_space
- type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;
-struct_declaration_nospace
- type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;
+ type_specifier .and struct_declarator_list .and semicolon .emit FIELD_NONE;
/*
* <struct_declarator_list> ::= <struct_declarator>
@@ -1123,10 +1080,6 @@ declaration_statement
*/
statement
compound_statement .or simple_statement;
-statement_space
- compound_statement .or statement_space_1;
-statement_space_1
- space .and simple_statement;
/*
* <simple_statement> ::= <__asm_statement>
@@ -1209,7 +1162,7 @@ selection_rest_statement
selection_rest_statement_1
selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;
selection_rest_statement_2
- "else" .and optional_space .and statement;
+ "else" .and statement;
/*
* <condition> ::= <expression>
@@ -1220,17 +1173,11 @@ selection_rest_statement_2
*/
condition
condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or
- condition_3 .emit OP_EXPRESSION;
+ condition_2 .emit OP_EXPRESSION;
condition_1
- condition_1_nospace .or condition_1_space;
-condition_1_nospace
- fully_specified_type_nospace .and condition_2;
-condition_1_space
- fully_specified_type_space .and space .and condition_2;
+ fully_specified_type .and identifier .emit VARIABLE_IDENTIFIER .and
+ equals .emit VARIABLE_INITIALIZER .and initializer .and .true .emit DECLARATOR_NONE;
condition_2
- identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and
- initializer .and .true .emit DECLARATOR_NONE;
-condition_3
expression .and .true .emit OP_END;
/*
@@ -1244,7 +1191,7 @@ iteration_statement_1
"while" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and
rparen .error RPAREN_EXPECTED .and statement;
iteration_statement_2
- "do" .emit OP_DO .and statement_space .and "while" .and lparen .error LPAREN_EXPECTED .and
+ "do" .emit OP_DO .and statement .and "while" .and lparen .error LPAREN_EXPECTED .and
expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;
iteration_statement_3
"for" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and
@@ -1295,7 +1242,7 @@ jump_statement_1
jump_statement_2
"break" .and semicolon .emit OP_BREAK;
jump_statement_3
- "return" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;
+ "return" .emit OP_RETURN .and expression .and semicolon .emit OP_END;
jump_statement_4
"return" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;
jump_statement_5
@@ -1308,7 +1255,7 @@ jump_statement_5
* normally slang disallows __asm statements
*/
__asm_statement
- "__asm" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;
+ "__asm" .and identifier .and asm_arguments .and semicolon .emit OP_END;
/*
* <asm_arguments> ::= <asm_argument>
@@ -1343,9 +1290,8 @@ var_with_field
* | <translation_unit> <external_declaration>
*/
translation_unit
- optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and
- .loop external_declaration .and optional_space .and
- '\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;
+ .true .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and
+ .loop external_declaration .and "@EOF" .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;
/*
@@ -1363,7 +1309,7 @@ external_declaration
* <precision_stmt> ::= "precision" <precision> <prectype>
*/
precision_stmt
- "precision" .and space .and precision .error INVALID_PRECISION .and space .and prectype .error INVALID_PRECISION_TYPE .and semicolon;
+ "precision" .and precision .error INVALID_PRECISION .and prectype .error INVALID_PRECISION_TYPE .and semicolon;
/*
* <precision> ::= "lowp"
@@ -1397,7 +1343,7 @@ prectype
* <invariant_stmt> ::= "invariant" identifier;
*/
invariant_stmt
- "invariant" .and space .and identifier .and semicolon;
+ "invariant" .and identifier .and semicolon;
/*
@@ -1412,83 +1358,18 @@ function_definition
* helper rules, not part of the official language syntax
*/
-digit_oct
- '0'-'7';
-
-digit_dec
- '0'-'9';
-
-digit_hex
- '0'-'9' .or 'A'-'F' .or 'a'-'f';
-
-id_character_first
- 'a'-'z' .or 'A'-'Z' .or '_';
-
-id_character_next
- id_character_first .or digit_dec;
-
identifier
- id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\0';
+ "@ID" .emit *;
float
- float_1 .or float_2 .or float_3;
-float_1
- float_fractional_constant .and float_optional_exponent_part .and optional_f_suffix;
-float_2
- float_digit_sequence .and .true .emit '\0' .and float_exponent_part .and optional_f_suffix;
-float_3
- float_digit_sequence .and .true .emit '\0' .and 'f' .emit '\0';
-
-float_fractional_constant
- float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;
-float_fractional_constant_1
- float_digit_sequence .and '.' .and float_digit_sequence;
-float_fractional_constant_2
- float_digit_sequence .and '.' .and .true .emit '\0';
-float_fractional_constant_3
- '.' .emit '\0' .and float_digit_sequence;
-
-float_optional_exponent_part
- float_exponent_part .or .true .emit '\0';
-
-float_digit_sequence
- digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
-
-float_exponent_part
- float_exponent_part_1 .or float_exponent_part_2;
-float_exponent_part_1
- 'e' .and float_optional_sign .and float_digit_sequence;
-float_exponent_part_2
- 'E' .and float_optional_sign .and float_digit_sequence;
-
-float_optional_sign
- float_sign .or .true;
-
-float_sign
- '+' .or '-' .emit '-';
-
-optional_f_suffix
- 'f' .or .true;
-
+ "@NUM" .emit 1 .emit *;
integer
- integer_hex .or integer_oct .or integer_dec;
-
-integer_hex
- '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and
- .true .emit '\0';
-integer_hex_1
- 'x' .or 'X';
-
-integer_oct
- '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\0';
-
-integer_dec
- digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
+ "@NUM" .emit 1 .emit *;
boolean
- "true" .emit 2 .emit '1' .emit '\0' .or
- "false" .emit 2 .emit '0' .emit '\0';
+ "true" .emit '1' .emit '\0' .or
+ "false" .emit '0' .emit '\0';
type_name
identifier;
@@ -1505,62 +1386,13 @@ intconstant
boolconstant
boolean .emit OP_PUSH_BOOL;
-optional_space
- .loop single_space;
-
-space
- single_space .and .loop single_space;
-
-single_space
- white_char .or c_style_comment_block .or cpp_style_comment_block;
-
-white_char
- ' ' .or '\t' .or new_line .or '\v' .or '\f';
-
-new_line
- cr_lf .or lf_cr .or '\n' .or '\r';
-
-cr_lf
- '\r' .and '\n';
-
-lf_cr
- '\n' .and '\r';
-
-c_style_comment_block
- '/' .and '*' .and c_style_comment_rest;
-
-c_style_comment_rest
- .loop c_style_comment_char_no_star .and c_style_comment_rest_1;
-c_style_comment_rest_1
- c_style_comment_end .or c_style_comment_rest_2;
-c_style_comment_rest_2
- '*' .and c_style_comment_rest;
-
-c_style_comment_char_no_star
- '\x2B'-'\xFF' .or '\x01'-'\x29';
-
-c_style_comment_end
- '*' .and '/';
-
-cpp_style_comment_block
- '/' .and '/' .and cpp_style_comment_block_1;
-cpp_style_comment_block_1
- cpp_style_comment_block_2 .or cpp_style_comment_block_3;
-cpp_style_comment_block_2
- .loop cpp_style_comment_char .and new_line;
-cpp_style_comment_block_3
- .loop cpp_style_comment_char;
-
-cpp_style_comment_char
- '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
-
/* lexical rules */
/*ampersand
optional_space .and '&' .and optional_space;*/
ampersandampersand
- optional_space .and '&' .and '&' .and optional_space;
+ "@&&";
/*ampersandequals
optional_space .and '&' .and '=' .and optional_space;*/
@@ -1569,46 +1401,46 @@ ampersandampersand
optional_space .and '|' .and optional_space;*/
barbar
- optional_space .and '|' .and '|' .and optional_space;
+ "@||";
/*barequals
optional_space .and '|' .and '=' .and optional_space;*/
bang
- optional_space .and '!' .and optional_space;
+ "@!";
bangequals
- optional_space .and '!' .and '=' .and optional_space;
+ "@!=";
/*caret
optional_space .and '^' .and optional_space;*/
caretcaret
- optional_space .and '^' .and '^' .and optional_space;
+ "@^^";
/*caretequals
optional_space .and '^' .and '=' .and optional_space;*/
colon
- optional_space .and ':' .and optional_space;
+ "@:";
comma
- optional_space .and ',' .and optional_space;
+ "@,";
dot
- optional_space .and '.' .and optional_space;
+ "@.";
equals
- optional_space .and '=' .and optional_space;
+ "@=";
equalsequals
- optional_space .and '=' .and '=' .and optional_space;
+ "@==";
greater
- optional_space .and '>' .and optional_space;
+ "@>";
greaterequals
- optional_space .and '>' .and '=' .and optional_space;
+ "@>=";
/*greatergreater
optional_space .and '>' .and '>' .and optional_space;*/
@@ -1617,16 +1449,16 @@ greaterequals
optional_space .and '>' .and '>' .and '=' .and optional_space;*/
lbrace
- optional_space .and '{' .and optional_space;
+ "@{";
lbracket
- optional_space .and '[' .and optional_space;
+ "@[";
less
- optional_space .and '<' .and optional_space;
+ "@<";
lessequals
- optional_space .and '<' .and '=' .and optional_space;
+ "@<=";
/*lessless
optional_space .and '<' .and '<' .and optional_space;*/
@@ -1635,16 +1467,16 @@ lessequals
optional_space .and '<' .and '<' .and '=' .and optional_space;*/
lparen
- optional_space .and '(' .and optional_space;
+ "@(";
minus
- optional_space .and '-' .and optional_space;
+ "@-";
minusequals
- optional_space .and '-' .and '=' .and optional_space;
+ "@-=";
minusminus
- optional_space .and '-' .and '-' .and optional_space;
+ "@--";
/*percent
optional_space .and '%' .and optional_space;*/
@@ -1653,64 +1485,41 @@ minusminus
optional_space .and '%' .and '=' .and optional_space;*/
plus
- optional_space .and '+' .and optional_space;
+ "@+";
plusequals
- optional_space .and '+' .and '=' .and optional_space;
+ "@+=";
plusplus
- optional_space .and '+' .and '+' .and optional_space;
+ "@++";
question
- optional_space .and '?' .and optional_space;
+ "@?";
rbrace
- optional_space .and '}' .and optional_space;
+ "@}";
rbracket
- optional_space .and ']' .and optional_space;
+ "@]";
rparen
- optional_space .and ')' .and optional_space;
+ "@)";
semicolon
- optional_space .and ';' .and optional_space;
+ "@;";
slash
- optional_space .and '/' .and optional_space;
+ "@/";
slashequals
- optional_space .and '/' .and '=' .and optional_space;
+ "@/=";
star
- optional_space .and '*' .and optional_space;
+ "@*";
starequals
- optional_space .and '*' .and '=' .and optional_space;
+ "@*=";
/*tilde
optional_space .and '~' .and optional_space;*/
-/* string rules - these are used internally by the parser when parsing quoted strings */
-
-.string string_lexer;
-
-string_lexer
- lex_first_identifier_character .and .loop lex_next_identifier_character;
-
-lex_first_identifier_character
- 'a'-'z' .or 'A'-'Z' .or '_';
-
-lex_next_identifier_character
- 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
-
-/* error rules - these are used by error messages */
-
-err_token
- '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or
- '-' .or '+' .or '=' .or '|' .or '\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '"' .or
- '\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;
-
-err_identifier
- id_character_first .and .loop id_character_next;
-