summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/library
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-09-07 21:30:34 +0200
committerMichal Krol <[email protected]>2009-09-07 21:30:34 +0200
commit5ddcdc42277ee2ba011980aebac7f3a12bd80c9d (patch)
tree739010d5aad4bb373aed9aff6ecf03231d531ab6 /src/mesa/shader/slang/library
parentce9309d24595af324a2c7222a96100cddf5f2c9b (diff)
slang: Adapt shader syntax description to grammar parser changes.
Diffstat (limited to 'src/mesa/shader/slang/library')
-rw-r--r--src/mesa/shader/slang/library/slang_shader.syn209
-rw-r--r--src/mesa/shader/slang/library/slang_shader_syn.h172
2 files changed, 78 insertions, 303 deletions
diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn
index cc5c70a02f8..cfd7b17b35d 100644
--- a/src/mesa/shader/slang/library/slang_shader.syn
+++ b/src/mesa/shader/slang/library/slang_shader.syn
@@ -1412,83 +1412,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 *;
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 *;
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;
@@ -1506,53 +1441,10 @@ boolconstant
boolean .emit OP_PUSH_BOOL;
optional_space
- .loop single_space;
+ .true;
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';
+ .true;
/* lexical rules */
@@ -1560,7 +1452,7 @@ cpp_style_comment_char
optional_space .and '&' .and optional_space;*/
ampersandampersand
- optional_space .and '&' .and '&' .and optional_space;
+ "@&&";
/*ampersandequals
optional_space .and '&' .and '=' .and optional_space;*/
@@ -1569,46 +1461,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 +1509,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 +1527,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 +1545,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;
-
diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h
index 6a382970e1a..d7ee0765613 100644
--- a/src/mesa/shader/slang/library/slang_shader_syn.h
+++ b/src/mesa/shader/slang/library/slang_shader_syn.h
@@ -682,64 +682,15 @@
" \"invariant\" .and space .and identifier .and semicolon;\n"
"function_definition\n"
" function_prototype .and compound_statement_no_new_scope;\n"
-"digit_oct\n"
-" '0'-'7';\n"
-"digit_dec\n"
-" '0'-'9';\n"
-"digit_hex\n"
-" '0'-'9' .or 'A'-'F' .or 'a'-'f';\n"
-"id_character_first\n"
-" 'a'-'z' .or 'A'-'Z' .or '_';\n"
-"id_character_next\n"
-" id_character_first .or digit_dec;\n"
"identifier\n"
-" id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n"
+" \"@ID\" .emit *;\n"
"float\n"
-" float_1 .or float_2 .or float_3;\n"
-"float_1\n"
-" float_fractional_constant .and float_optional_exponent_part .and optional_f_suffix;\n"
-"float_2\n"
-" float_digit_sequence .and .true .emit '\\0' .and float_exponent_part .and optional_f_suffix;\n"
-"float_3\n"
-" float_digit_sequence .and .true .emit '\\0' .and 'f' .emit '\\0';\n"
-"float_fractional_constant\n"
-" float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n"
-"float_fractional_constant_1\n"
-" float_digit_sequence .and '.' .and float_digit_sequence;\n"
-"float_fractional_constant_2\n"
-" float_digit_sequence .and '.' .and .true .emit '\\0';\n"
-"float_fractional_constant_3\n"
-" '.' .emit '\\0' .and float_digit_sequence;\n"
-"float_optional_exponent_part\n"
-" float_exponent_part .or .true .emit '\\0';\n"
-"float_digit_sequence\n"
-" digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
-"float_exponent_part\n"
-" float_exponent_part_1 .or float_exponent_part_2;\n"
-"float_exponent_part_1\n"
-" 'e' .and float_optional_sign .and float_digit_sequence;\n"
-"float_exponent_part_2\n"
-" 'E' .and float_optional_sign .and float_digit_sequence;\n"
-"float_optional_sign\n"
-" float_sign .or .true;\n"
-"float_sign\n"
-" '+' .or '-' .emit '-';\n"
-"optional_f_suffix\n"
-" 'f' .or .true;\n"
+" \"@NUM\" .emit *;\n"
"integer\n"
-" integer_hex .or integer_oct .or integer_dec;\n"
-"integer_hex\n"
-" '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n"
-" .true .emit '\\0';\n"
-"integer_hex_1\n"
-" 'x' .or 'X';\n"
-"integer_oct\n"
-" '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n"
-"integer_dec\n"
-" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n"
+" \"@NUM\" .emit *;\n"
"boolean\n"
-" \"true\" .emit 2 .emit '1' .emit '\\0' .or\n"
-" \"false\" .emit 2 .emit '0' .emit '\\0';\n"
+" \"true\" .emit '1' .emit '\\0' .or\n"
+" \"false\" .emit '0' .emit '\\0';\n"
"type_name\n"
" identifier;\n"
"field_selection\n"
@@ -751,116 +702,71 @@
"boolconstant\n"
" boolean .emit OP_PUSH_BOOL;\n"
"optional_space\n"
-" .loop single_space;\n"
+" .true;\n"
"space\n"
-" single_space .and .loop single_space;\n"
-"single_space\n"
-" white_char .or c_style_comment_block .or cpp_style_comment_block;\n"
-"white_char\n"
-" ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n"
-"new_line\n"
-" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
-"cr_lf\n"
-" '\\r' .and '\\n';\n"
-"lf_cr\n"
-" '\\n' .and '\\r';\n"
-"c_style_comment_block\n"
-" '/' .and '*' .and c_style_comment_rest;\n"
-"c_style_comment_rest\n"
-" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
-"c_style_comment_rest_1\n"
-" c_style_comment_end .or c_style_comment_rest_2;\n"
-"c_style_comment_rest_2\n"
-" '*' .and c_style_comment_rest;\n"
-"c_style_comment_char_no_star\n"
-" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
-"c_style_comment_end\n"
-" '*' .and '/';\n"
-"cpp_style_comment_block\n"
-" '/' .and '/' .and cpp_style_comment_block_1;\n"
-"cpp_style_comment_block_1\n"
-" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
-"cpp_style_comment_block_2\n"
-" .loop cpp_style_comment_char .and new_line;\n"
-"cpp_style_comment_block_3\n"
-" .loop cpp_style_comment_char;\n"
-"cpp_style_comment_char\n"
-" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
+" .true;\n"
"ampersandampersand\n"
-" optional_space .and '&' .and '&' .and optional_space;\n"
+" \"@&&\";\n"
"barbar\n"
-" optional_space .and '|' .and '|' .and optional_space;\n"
+" \"@||\";\n"
"bang\n"
-" optional_space .and '!' .and optional_space;\n"
+" \"@!\";\n"
"bangequals\n"
-" optional_space .and '!' .and '=' .and optional_space;\n"
+" \"@!=\";\n"
"caretcaret\n"
-" optional_space .and '^' .and '^' .and optional_space;\n"
+" \"@^^\";\n"
"colon\n"
-" optional_space .and ':' .and optional_space;\n"
+" \"@:\";\n"
"comma\n"
-" optional_space .and ',' .and optional_space;\n"
+" \"@,\";\n"
"dot\n"
-" optional_space .and '.' .and optional_space;\n"
+" \"@.\";\n"
"equals\n"
-" optional_space .and '=' .and optional_space;\n"
+" \"@=\";\n"
"equalsequals\n"
-" optional_space .and '=' .and '=' .and optional_space;\n"
+" \"@==\";\n"
"greater\n"
-" optional_space .and '>' .and optional_space;\n"
+" \"@>\";\n"
"greaterequals\n"
-" optional_space .and '>' .and '=' .and optional_space;\n"
+" \"@>=\";\n"
"lbrace\n"
-" optional_space .and '{' .and optional_space;\n"
+" \"@{\";\n"
"lbracket\n"
-" optional_space .and '[' .and optional_space;\n"
+" \"@[\";\n"
"less\n"
-" optional_space .and '<' .and optional_space;\n"
+" \"@<\";\n"
"lessequals\n"
-" optional_space .and '<' .and '=' .and optional_space;\n"
+" \"@<=\";\n"
"lparen\n"
-" optional_space .and '(' .and optional_space;\n"
+" \"@(\";\n"
"minus\n"
-" optional_space .and '-' .and optional_space;\n"
+" \"@-\";\n"
"minusequals\n"
-" optional_space .and '-' .and '=' .and optional_space;\n"
+" \"@-=\";\n"
"minusminus\n"
-" optional_space .and '-' .and '-' .and optional_space;\n"
+" \"@--\";\n"
"plus\n"
-" optional_space .and '+' .and optional_space;\n"
+" \"@+\";\n"
"plusequals\n"
-" optional_space .and '+' .and '=' .and optional_space;\n"
+" \"@+=\";\n"
"plusplus\n"
-" optional_space .and '+' .and '+' .and optional_space;\n"
+" \"@++\";\n"
"question\n"
-" optional_space .and '?' .and optional_space;\n"
+" \"@?\";\n"
"rbrace\n"
-" optional_space .and '}' .and optional_space;\n"
+" \"@}\";\n"
"rbracket\n"
-" optional_space .and ']' .and optional_space;\n"
+" \"@]\";\n"
"rparen\n"
-" optional_space .and ')' .and optional_space;\n"
+" \"@)\";\n"
"semicolon\n"
-" optional_space .and ';' .and optional_space;\n"
+" \"@;\";\n"
"slash\n"
-" optional_space .and '/' .and optional_space;\n"
+" \"@/\";\n"
"slashequals\n"
-" optional_space .and '/' .and '=' .and optional_space;\n"
+" \"@/=\";\n"
"star\n"
-" optional_space .and '*' .and optional_space;\n"
+" \"@*\";\n"
"starequals\n"
-" optional_space .and '*' .and '=' .and optional_space;\n"
-".string string_lexer;\n"
-"string_lexer\n"
-" lex_first_identifier_character .and .loop lex_next_identifier_character;\n"
-"lex_first_identifier_character\n"
-" 'a'-'z' .or 'A'-'Z' .or '_';\n"
-"lex_next_identifier_character\n"
-" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n"
-"err_token\n"
-" '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n"
-" '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n"
-" '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n"
-"err_identifier\n"
-" id_character_first .and .loop id_character_next;\n"
+" \"@*=\";\n"
""