diff options
author | Michal Krol <[email protected]> | 2006-09-26 11:43:30 +0000 |
---|---|---|
committer | Michal Krol <[email protected]> | 2006-09-26 11:43:30 +0000 |
commit | 16647b739baf9701e3d037fc7030f45e7bde5c7e (patch) | |
tree | 0fad25d1ae7e83d26c8bb638d73e367aafb6e08a /src/mesa/shader | |
parent | a50b7dbc3ba1db8c92b4bbb4f7f06de8d6c039c4 (diff) |
Add syntax files for expression and directive preprocessor.
Fix syntax errors in builtin library 1.2 sources.
All derivative files (*_gc.h and *_syn.h) are generated by Makefile.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/library/Makefile | 85 | ||||
-rwxr-xr-x | src/mesa/shader/slang/library/gc_to_bin.c | 41 | ||||
-rwxr-xr-x | src/mesa/shader/slang/library/slang_builtin_120_common.gc | 6 | ||||
-rwxr-xr-x | src/mesa/shader/slang/library/slang_pp_directives.syn | 385 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_pp_directives_syn.h | 337 | ||||
-rwxr-xr-x | src/mesa/shader/slang/library/slang_pp_expression.syn | 265 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_pp_expression_syn.h | 234 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_pp_version.syn | 4 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_shader_syn.h | 3 |
9 files changed, 1332 insertions, 28 deletions
diff --git a/src/mesa/shader/slang/library/Makefile b/src/mesa/shader/slang/library/Makefile new file mode 100644 index 00000000000..92a313d7b0d --- /dev/null +++ b/src/mesa/shader/slang/library/Makefile @@ -0,0 +1,85 @@ +# src/mesa/shader/slang/library/Makefile + +TOP = ../../../../.. + +include $(TOP)/configs/current + +INCDIR = $(TOP)/include + +LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) + +# +# targets +# + +.PHONY: default clean + +default: syntax builtin + +clean: + rm -f syn_to_c gc_to_bin *_syn.h *_gc.h + +syntax: slang_pp_directives_syn.h slang_pp_expression_syn.h slang_shader_syn.h slang_pp_version_syn.h + +builtin: builtin_110 builtin_120 builtin_vec4 + +# +# executables +# + +syn_to_c: syn_to_c.c + $(CC) syn_to_c.c -o syn_to_c + +gc_to_bin: gc_to_bin.c slang_shader_syn.h + $(CC) gc_to_bin.c -o gc_to_bin + +# +# syntax scripts +# + +slang_pp_directives_syn.h: syn_to_c slang_pp_directives.syn + ./syn_to_c slang_pp_directives.syn > slang_pp_directives_syn.h + +slang_pp_expression_syn.h: syn_to_c slang_pp_expression.syn + ./syn_to_c slang_pp_expression.syn > slang_pp_expression_syn.h + +slang_shader_syn.h: syn_to_c slang_shader.syn + ./syn_to_c slang_shader.syn > slang_shader_syn.h + +slang_pp_version_syn.h: syn_to_c slang_pp_version.syn + ./syn_to_c slang_pp_version.syn > slang_pp_version_syn.h + +# +# builtin library sources +# + +builtin_110: slang_common_builtin_gc.h slang_core_gc.h slang_fragment_builtin_gc.h slang_vertex_builtin_gc.h + +builtin_120: slang_120_core_gc.h slang_builtin_120_common_gc.h slang_builtin_120_fragment_gc.h + +builtin_vec4: slang_builtin_vec4_gc.h + +slang_120_core_gc.h: gc_to_bin slang_120_core.gc + ./gc_to_bin 1 slang_120_core.gc slang_120_core_gc.h + +slang_builtin_120_common_gc.h: gc_to_bin slang_builtin_120_common.gc + ./gc_to_bin 1 slang_builtin_120_common.gc slang_builtin_120_common_gc.h + +slang_builtin_120_fragment_gc.h: gc_to_bin slang_builtin_120_fragment.gc + ./gc_to_bin 1 slang_builtin_120_fragment.gc slang_builtin_120_fragment_gc.h + +slang_builtin_vec4_gc.h: gc_to_bin slang_builtin_vec4.gc + ./gc_to_bin 1 slang_builtin_vec4.gc slang_builtin_vec4_gc.h + +slang_common_builtin_gc.h: gc_to_bin slang_common_builtin.gc + ./gc_to_bin 1 slang_common_builtin.gc slang_common_builtin_gc.h + +slang_core_gc.h: gc_to_bin slang_core.gc + ./gc_to_bin 1 slang_core.gc slang_core_gc.h + +slang_fragment_builtin_gc.h: gc_to_bin slang_fragment_builtin.gc + ./gc_to_bin 1 slang_fragment_builtin.gc slang_fragment_builtin_gc.h + +slang_vertex_builtin_gc.h: gc_to_bin slang_vertex_builtin.gc + ./gc_to_bin 2 slang_vertex_builtin.gc slang_vertex_builtin_gc.h + diff --git a/src/mesa/shader/slang/library/gc_to_bin.c b/src/mesa/shader/slang/library/gc_to_bin.c index 69895d84bfd..ce9a6541acc 100755 --- a/src/mesa/shader/slang/library/gc_to_bin.c +++ b/src/mesa/shader/slang/library/gc_to_bin.c @@ -1,12 +1,13 @@ #include "../../grammar/grammar_crt.h" #include "../../grammar/grammar_crt.c" +#include <stdlib.h> #include <stdio.h> static const char *slang_shader_syn = #include "slang_shader_syn.h" ; -static void gc_to_bin (grammar id, const char *in, const char *out) +static int gc_to_bin (grammar id, const char *in, const char *out) { FILE *f; byte *source, *prod; @@ -16,7 +17,7 @@ static void gc_to_bin (grammar id, const char *in, const char *out) f = fopen (in, "r"); if (f == NULL) - return; + return 1; fseek (f, 0, SEEK_END); size = ftell (f); fseek (f, 0, SEEK_SET); @@ -27,7 +28,7 @@ static void gc_to_bin (grammar id, const char *in, const char *out) if (!grammar_fast_check (id, source, &prod, &size, 65536)) { grammar_alloc_free (source); - return; + return 1; } f = fopen (out, "w"); @@ -59,29 +60,23 @@ static void gc_to_bin (grammar id, const char *in, const char *out) fprintf (f, "\n"); fclose (f); grammar_alloc_free (prod); + return 0; } -int main () +int main (int argc, char *argv[]) { - grammar id; - - id = grammar_load_from_text ((const byte *) slang_shader_syn); - if (id == 0) - return 1; - - grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); - - grammar_set_reg8 (id, (const byte *) "shader_type", 1); - gc_to_bin (id, "slang_core.gc", "slang_core_gc.h"); - gc_to_bin (id, "slang_common_builtin.gc", "slang_common_builtin_gc.h"); - gc_to_bin (id, "slang_fragment_builtin.gc", "slang_fragment_builtin_gc.h"); - gc_to_bin (id, "slang_builtin_vec4.gc", "slang_builtin_vec4_gc.h"); - - grammar_set_reg8 (id, (const byte *) "shader_type", 2); - gc_to_bin (id, "slang_vertex_builtin.gc", "slang_vertex_builtin_gc.h"); - - grammar_destroy (id); + grammar id; - return 0; + id = grammar_load_from_text ((const byte *) slang_shader_syn); + if (id == 0) + return 1; + grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); + grammar_set_reg8 (id, (const byte *) "shader_type", atoi (argv[1])); + if (gc_to_bin (id, argv[2], argv[3])) { + grammar_destroy (id); + return 1; + } + grammar_destroy (id); + return 0; } diff --git a/src/mesa/shader/slang/library/slang_builtin_120_common.gc b/src/mesa/shader/slang/library/slang_builtin_120_common.gc index 7e81c83415e..c6264c3b471 100755 --- a/src/mesa/shader/slang/library/slang_builtin_120_common.gc +++ b/src/mesa/shader/slang/library/slang_builtin_120_common.gc @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.6 * * Copyright (C) 2006 Brian Paul All Rights Reserved. * @@ -80,7 +80,7 @@ mat4 outerProduct (vec4 c, vec4 r) { mat2x3 outerProduct (vec3 c, vec2 r) { return mat2x3 ( - c.x * r.x, c.y * r.x, c.z * r.x + c.x * r.x, c.y * r.x, c.z * r.x, c.x * r.y, c.y * r.y, c.z * r.y ); } @@ -105,7 +105,7 @@ mat4x2 outerProduct (vec2 c, vec4 r) { c.x * r.x, c.y * r.x, c.x * r.y, c.y * r.y, c.x * r.z, c.y * r.z, - c.x * r.w, c.y * r.w, + c.x * r.w, c.y * r.w ); } diff --git a/src/mesa/shader/slang/library/slang_pp_directives.syn b/src/mesa/shader/slang/library/slang_pp_directives.syn new file mode 100755 index 00000000000..5cbd15fd33d --- /dev/null +++ b/src/mesa/shader/slang/library/slang_pp_directives.syn @@ -0,0 +1,385 @@ +/*
+ * Mesa 3-D graphics library
+ * Version: 6.6
+ *
+ * Copyright (C) 2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_pp_directives.syn
+ * slang preprocessor directives parser
+ * \author Michal Krol
+ */
+
+.syntax source;
+
+/*
+ * This syntax script preprocesses a GLSL shader.
+ * It is assumed, that the #version directive has been parsed. Separate pass for parsing
+ * version gives better control on behavior depending on the version number given.
+ *
+ * The output is a source string with comments and directives removed. White spaces and comments
+ * are replaced with on or more spaces. All new-lines are preserved and converted to Linux format.
+ * Directives are escaped with a null character. The end of the source string is marked by
+ * two consecutive null characters. The consumer is responsible for executing the escaped
+ * directives, removing dead portions of code and expanding macros.
+ */
+
+.emtcode ESCAPE_TOKEN 0
+
+/*
+ * The TOKEN_* symbols follow the ESCAPE_TOKEN.
+ *
+ * NOTE:
+ * There is no TOKEN_IFDEF and neither is TOKEN_IFNDEF. They are handled with TOKEN_IF and
+ * operator defined.
+ * The "#ifdef SYMBOL" is replaced with "#if defined SYMBOL"
+ * The "#ifndef SYMBOL" is replaced with "#if !defined SYMBOL"
+ */
+.emtcode TOKEN_END 0
+.emtcode TOKEN_DEFINE 1
+.emtcode TOKEN_UNDEF 2
+.emtcode TOKEN_IF 3
+.emtcode TOKEN_ELSE 4
+.emtcode TOKEN_ELIF 5
+.emtcode TOKEN_ENDIF 6
+.emtcode TOKEN_ERROR 7
+.emtcode TOKEN_PRAGMA 8
+.emtcode TOKEN_EXTENSION 9
+.emtcode TOKEN_LINE 10
+
+/*
+ * The PARAM_* symbols follow the TOKEN_DEFINE.
+ */
+.emtcode PARAM_END 0
+.emtcode PARAM_PARAMETER 1
+
+/*
+ * The BEHAVIOR_* symbols follow the TOKEN_EXTENSION.
+ */
+.emtcode BEHAVIOR_REQUIRE 1
+.emtcode BEHAVIOR_ENABLE 2
+.emtcode BEHAVIOR_WARN 3
+.emtcode BEHAVIOR_DISABLE 4
+
+source
+ optional_directive .and .loop source_element .and '\0' .emit ESCAPE_TOKEN .emit TOKEN_END;
+
+source_element
+ c_style_comment_block .or cpp_style_comment_block .or new_line_directive .or source_token;
+
+c_style_comment_block
+ '/' .and '*' .and c_style_comment_rest .and .true .emit ' ';
+
+c_style_comment_rest
+ .loop c_style_comment_body .and c_style_comment_end;
+
+c_style_comment_body
+ c_style_comment_char_nostar .or c_style_comment_char_star_noslashstar;
+
+c_style_comment_char_nostar
+ new_line .or '\x2B'-'\xFF' .or '\x01'-'\x29';
+
+c_style_comment_char_star_noslashstar
+ '*' .and c_style_comment_char_star_noslashstar_1;
+c_style_comment_char_star_noslashstar_1
+ c_style_comment_char_noslashstar .or c_style_comment_char_star_noslashstar;
+
+c_style_comment_char_noslashstar
+ new_line .or '\x30'-'\xFF' .or '\x01'-'\x29' .or '\x2B'-'\x2E';
+
+c_style_comment_end
+ '*' .and .loop c_style_comment_char_star .and '/';
+
+c_style_comment_char_star
+ '*';
+
+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_directive;
+cpp_style_comment_block_3
+ .loop cpp_style_comment_char;
+
+cpp_style_comment_char
+ '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
+
+new_line_directive
+ new_line .and optional_directive;
+
+new_line
+ generic_new_line .emit '\n';
+
+generic_new_line
+ carriage_return_line_feed .or line_feed_carriage_return .or '\n' .or '\r';
+
+carriage_return_line_feed
+ '\r' .and '\n';
+
+line_feed_carriage_return
+ '\n' .and '\r';
+
+optional_directive
+ directive .emit ESCAPE_TOKEN .or .true;
+
+directive
+ dir_define .emit TOKEN_DEFINE .or
+ dir_undef .emit TOKEN_UNDEF .or
+ dir_if .emit TOKEN_IF .or
+ dir_ifdef .emit TOKEN_IF .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e' .emit 'd'
+ .emit ' ' .or
+ dir_ifndef .emit TOKEN_IF .emit '!' .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e'
+ .emit 'd' .emit ' ' .or
+ dir_else .emit TOKEN_ELSE .or
+ dir_elif .emit TOKEN_ELIF .or
+ dir_endif .emit TOKEN_ENDIF .or
+ dir_ext .emit TOKEN_EXTENSION .or
+ dir_line .emit TOKEN_LINE;
+
+dir_define
+ optional_space .and '#' .and optional_space .and "define" .and symbol .and opt_parameters .and
+ definition;
+
+dir_undef
+ optional_space .and '#' .and optional_space .and "undef" .and symbol;
+
+dir_if
+ optional_space .and '#' .and optional_space .and "if" .and expression;
+
+dir_ifdef
+ optional_space .and '#' .and optional_space .and "ifdef" .and symbol;
+
+dir_ifndef
+ optional_space .and '#' .and optional_space .and "ifndef" .and symbol;
+
+dir_else
+ optional_space .and '#' .and optional_space .and "else";
+
+dir_elif
+ optional_space .and '#' .and optional_space .and "elif" .and expression;
+
+dir_endif
+ optional_space .and '#' .and optional_space .and "endif";
+
+dir_ext
+ optional_space .and '#' .and optional_space .and "extension" .and space .and extension_name .and
+ optional_space .and ':' .and optional_space .and extension_behavior;
+
+dir_line
+ optional_space .and '#' .and optional_space .and "line" .and expression;
+
+symbol
+ space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
+
+opt_parameters
+ parameters .or .true .emit PARAM_END;
+
+parameters
+ '(' .and parameters_1 .and optional_space .and ')' .emit PARAM_END;
+parameters_1
+ parameters_2 .or .true;
+parameters_2
+ parameter .emit PARAM_PARAMETER .and .loop parameters_3;
+parameters_3
+ optional_space .and ',' .and parameter .emit PARAM_PARAMETER;
+
+parameter
+ optional_space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and
+ .true .emit '\0';
+
+definition
+ .loop definition_character .emit * .and .true .emit '\0';
+
+definition_character
+ '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
+
+expression
+ expression_element .and .loop expression_element .and .true .emit '\0';
+
+expression_element
+ expression_character .emit *;
+
+expression_character
+ '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
+
+extension_name
+ symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
+
+extension_behavior
+ "require" .emit BEHAVIOR_REQUIRE .or
+ "enable" .emit BEHAVIOR_ENABLE .or
+ "warn" .emit BEHAVIOR_WARN .or
+ "disable" .emit BEHAVIOR_DISABLE;
+
+optional_space
+ .loop single_space;
+
+space
+ single_space .and .loop single_space;
+
+single_space
+ ' ' .or '\t';
+
+source_token
+ space .emit ' ' .or complex_token .or source_token_1;
+source_token_1
+ simple_token .emit ' ' .and .true .emit ' ';
+
+/*
+ * All possible tokens.
+ */
+
+complex_token
+ identifier .or number;
+
+simple_token
+ increment .or decrement .or lequal .or gequal .or equal .or nequal .or and .or xor .or or .or
+ addto .or subtractfrom .or multiplyto .or divideto .or other;
+
+identifier
+ identifier_char1 .emit * .and .loop identifier_char2 .emit *;
+identifier_char1
+ 'a'-'z' .or 'A'-'Z' .or '_';
+identifier_char2
+ 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
+
+number
+ float .or integer;
+
+digit_oct
+ '0'-'7';
+
+digit_dec
+ '0'-'9';
+
+digit_hex
+ '0'-'9' .or 'A'-'F' .or 'a'-'f';
+
+float
+ float_1 .or float_2;
+float_1
+ float_fractional_constant .and float_optional_exponent_part;
+float_2
+ float_digit_sequence .and float_exponent_part;
+
+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 '.' .emit '.' .and float_digit_sequence;
+float_fractional_constant_2
+ float_digit_sequence .and '.' .emit '.';
+float_fractional_constant_3
+ '.' .emit '.' .and float_digit_sequence;
+
+float_optional_exponent_part
+ float_exponent_part .or .true;
+
+float_digit_sequence
+ digit_dec .emit * .and .loop digit_dec .emit *;
+
+float_exponent_part
+ float_exponent_part_1 .or float_exponent_part_2;
+float_exponent_part_1
+ 'e' .emit 'e' .and float_optional_sign .and float_digit_sequence;
+float_exponent_part_2
+ 'E' .emit 'E' .and float_optional_sign .and float_digit_sequence;
+
+float_optional_sign
+ '+' .emit '+' .or '-' .emit '-' .or .true;
+
+integer
+ integer_hex .or integer_oct .or integer_dec;
+
+integer_hex
+ '0' .emit '0' .and integer_hex_1 .emit * .and digit_hex .emit * .and
+ .loop digit_hex .emit *;
+integer_hex_1
+ 'x' .or 'X';
+
+integer_oct
+ '0' .emit '0' .and .loop digit_oct .emit *;
+
+integer_dec
+ digit_dec .emit * .and .loop digit_dec .emit *;
+
+increment
+ '+' .emit * .and '+' .emit *;
+
+decrement
+ '-' .emit * .and '-' .emit *;
+
+lequal
+ '<' .emit * .and '=' .emit *;
+
+gequal
+ '>' .emit * .and '=' .emit *;
+
+equal
+ '=' .emit * .and '=' .emit *;
+
+nequal
+ '!' .emit * .and '=' .emit *;
+
+and
+ '&' .emit * .and '&' .emit *;
+
+xor
+ '^' .emit * .and '^' .emit *;
+
+or
+ '|' .emit * .and '|' .emit *;
+
+addto
+ '+' .emit * .and '=' .emit *;
+
+subtractfrom
+ '-' .emit * .and '=' .emit *;
+
+multiplyto
+ '*' .emit * .and '=' .emit *;
+
+divideto
+ '/' .emit * .and '=' .emit *;
+
+/*
+ * All characters except '\0' and '#'.
+ */
+other
+ '\x24'-'\xFF' .emit * .or '\x01'-'\x22' .emit *;
+
+symbol_character
+ 'A'-'Z' .or 'a'-'z' .or '_';
+
+symbol_character2
+ 'A'-'Z' .or 'a'-'z' .or '0'-'9' .or '_';
+
+.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 '_';
+
diff --git a/src/mesa/shader/slang/library/slang_pp_directives_syn.h b/src/mesa/shader/slang/library/slang_pp_directives_syn.h new file mode 100644 index 00000000000..71c08ca8240 --- /dev/null +++ b/src/mesa/shader/slang/library/slang_pp_directives_syn.h @@ -0,0 +1,337 @@ + +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */ + +"
\n" +"
\n" +"
\n" +"
\n" +".syntax source;
\n" +"
\n" +"
\n" +"
\n" +".emtcode ESCAPE_TOKEN 0
\n" +"
\n" +"
\n" +".emtcode TOKEN_END 0
\n" +".emtcode TOKEN_DEFINE 1
\n" +".emtcode TOKEN_UNDEF 2
\n" +".emtcode TOKEN_IF 3
\n" +".emtcode TOKEN_ELSE 4
\n" +".emtcode TOKEN_ELIF 5
\n" +".emtcode TOKEN_ENDIF 6
\n" +".emtcode TOKEN_ERROR 7
\n" +".emtcode TOKEN_PRAGMA 8
\n" +".emtcode TOKEN_EXTENSION 9
\n" +".emtcode TOKEN_LINE 10
\n" +"
\n" +"
\n" +".emtcode PARAM_END 0
\n" +".emtcode PARAM_PARAMETER 1
\n" +"
\n" +"
\n" +".emtcode BEHAVIOR_REQUIRE 1
\n" +".emtcode BEHAVIOR_ENABLE 2
\n" +".emtcode BEHAVIOR_WARN 3
\n" +".emtcode BEHAVIOR_DISABLE 4
\n" +"
\n" +"source
\n" +" optional_directive .and .loop source_element .and '\\0' .emit ESCAPE_TOKEN .emit TOKEN_END;
\n" +"
\n" +"source_element
\n" +" c_style_comment_block .or cpp_style_comment_block .or new_line_directive .or source_token;
\n" +"
\n" +"c_style_comment_block
\n" +" '/' .and '*' .and c_style_comment_rest .and .true .emit ' ';
\n" +"
\n" +"c_style_comment_rest
\n" +" .loop c_style_comment_body .and c_style_comment_end;
\n" +"
\n" +"c_style_comment_body
\n" +" c_style_comment_char_nostar .or c_style_comment_char_star_noslashstar;
\n" +"
\n" +"c_style_comment_char_nostar
\n" +" new_line .or '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';
\n" +"
\n" +"c_style_comment_char_star_noslashstar
\n" +" '*' .and c_style_comment_char_star_noslashstar_1;
\n" +"c_style_comment_char_star_noslashstar_1
\n" +" c_style_comment_char_noslashstar .or c_style_comment_char_star_noslashstar;
\n" +"
\n" +"c_style_comment_char_noslashstar
\n" +" new_line .or '\\x30'-'\\xFF' .or '\\x01'-'\\x29' .or '\\x2B'-'\\x2E';
\n" +"
\n" +"c_style_comment_end
\n" +" '*' .and .loop c_style_comment_char_star .and '/';
\n" +"
\n" +"c_style_comment_char_star
\n" +" '*';
\n" +"
\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_directive;
\n" +"cpp_style_comment_block_3
\n" +" .loop cpp_style_comment_char;
\n" +"
\n" +"cpp_style_comment_char
\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';
\n" +"
\n" +"new_line_directive
\n" +" new_line .and optional_directive;
\n" +"
\n" +"new_line
\n" +" generic_new_line .emit '\\n';
\n" +"
\n" +"generic_new_line
\n" +" carriage_return_line_feed .or line_feed_carriage_return .or '\\n' .or '\\r';
\n" +"
\n" +"carriage_return_line_feed
\n" +" '\\r' .and '\\n';
\n" +"
\n" +"line_feed_carriage_return
\n" +" '\\n' .and '\\r';
\n" +"
\n" +"optional_directive
\n" +" directive .emit ESCAPE_TOKEN .or .true;
\n" +"
\n" +"directive
\n" +" dir_define .emit TOKEN_DEFINE .or
\n" +" dir_undef .emit TOKEN_UNDEF .or
\n" +" dir_if .emit TOKEN_IF .or
\n" +" dir_ifdef .emit TOKEN_IF .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e' .emit 'd'
\n" +" .emit ' ' .or
\n" +" dir_ifndef .emit TOKEN_IF .emit '!' .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e'
\n" +" .emit 'd' .emit ' ' .or
\n" +" dir_else .emit TOKEN_ELSE .or
\n" +" dir_elif .emit TOKEN_ELIF .or
\n" +" dir_endif .emit TOKEN_ENDIF .or
\n" +" dir_ext .emit TOKEN_EXTENSION .or
\n" +" dir_line .emit TOKEN_LINE;
\n" +"
\n" +"dir_define
\n" +" optional_space .and '#' .and optional_space .and \"define\" .and symbol .and opt_parameters .and
\n" +" definition;
\n" +"
\n" +"dir_undef
\n" +" optional_space .and '#' .and optional_space .and \"undef\" .and symbol;
\n" +"
\n" +"dir_if
\n" +" optional_space .and '#' .and optional_space .and \"if\" .and expression;
\n" +"
\n" +"dir_ifdef
\n" +" optional_space .and '#' .and optional_space .and \"ifdef\" .and symbol;
\n" +"
\n" +"dir_ifndef
\n" +" optional_space .and '#' .and optional_space .and \"ifndef\" .and symbol;
\n" +"
\n" +"dir_else
\n" +" optional_space .and '#' .and optional_space .and \"else\";
\n" +"
\n" +"dir_elif
\n" +" optional_space .and '#' .and optional_space .and \"elif\" .and expression;
\n" +"
\n" +"dir_endif
\n" +" optional_space .and '#' .and optional_space .and \"endif\";
\n" +"
\n" +"dir_ext
\n" +" optional_space .and '#' .and optional_space .and \"extension\" .and space .and extension_name .and
\n" +" optional_space .and ':' .and optional_space .and extension_behavior;
\n" +"
\n" +"dir_line
\n" +" optional_space .and '#' .and optional_space .and \"line\" .and expression;
\n" +"
\n" +"symbol
\n" +" space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\\0';
\n" +"
\n" +"opt_parameters
\n" +" parameters .or .true .emit PARAM_END;
\n" +"
\n" +"parameters
\n" +" '(' .and parameters_1 .and optional_space .and ')' .emit PARAM_END;
\n" +"parameters_1
\n" +" parameters_2 .or .true;
\n" +"parameters_2
\n" +" parameter .emit PARAM_PARAMETER .and .loop parameters_3;
\n" +"parameters_3
\n" +" optional_space .and ',' .and parameter .emit PARAM_PARAMETER;
\n" +"
\n" +"parameter
\n" +" optional_space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and
\n" +" .true .emit '\\0';
\n" +"
\n" +"definition
\n" +" .loop definition_character .emit * .and .true .emit '\\0';
\n" +"
\n" +"definition_character
\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';
\n" +"
\n" +"expression
\n" +" expression_element .and .loop expression_element .and .true .emit '\\0';
\n" +"
\n" +"expression_element
\n" +" expression_character .emit *;
\n" +"
\n" +"expression_character
\n" +" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';
\n" +"
\n" +"extension_name
\n" +" symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\\0';
\n" +"
\n" +"extension_behavior
\n" +" \"require\" .emit BEHAVIOR_REQUIRE .or
\n" +" \"enable\" .emit BEHAVIOR_ENABLE .or
\n" +" \"warn\" .emit BEHAVIOR_WARN .or
\n" +" \"disable\" .emit BEHAVIOR_DISABLE;
\n" +"
\n" +"optional_space
\n" +" .loop single_space;
\n" +"
\n" +"space
\n" +" single_space .and .loop single_space;
\n" +"
\n" +"single_space
\n" +" ' ' .or '\\t';
\n" +"
\n" +"source_token
\n" +" space .emit ' ' .or complex_token .or source_token_1;
\n" +"source_token_1
\n" +" simple_token .emit ' ' .and .true .emit ' ';
\n" +"
\n" +"
\n" +"
\n" +"complex_token
\n" +" identifier .or number;
\n" +"
\n" +"simple_token
\n" +" increment .or decrement .or lequal .or gequal .or equal .or nequal .or and .or xor .or or .or
\n" +" addto .or subtractfrom .or multiplyto .or divideto .or other;
\n" +"
\n" +"identifier
\n" +" identifier_char1 .emit * .and .loop identifier_char2 .emit *;
\n" +"identifier_char1
\n" +" 'a'-'z' .or 'A'-'Z' .or '_';
\n" +"identifier_char2
\n" +" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
\n" +"
\n" +"number
\n" +" float .or integer;
\n" +"
\n" +"digit_oct
\n" +" '0'-'7';
\n" +"
\n" +"digit_dec
\n" +" '0'-'9';
\n" +"
\n" +"digit_hex
\n" +" '0'-'9' .or 'A'-'F' .or 'a'-'f';
\n" +"
\n" +"float
\n" +" float_1 .or float_2;
\n" +"float_1
\n" +" float_fractional_constant .and float_optional_exponent_part;
\n" +"float_2
\n" +" float_digit_sequence .and float_exponent_part;
\n" +"
\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 '.' .emit '.' .and float_digit_sequence;
\n" +"float_fractional_constant_2
\n" +" float_digit_sequence .and '.' .emit '.';
\n" +"float_fractional_constant_3
\n" +" '.' .emit '.' .and float_digit_sequence;
\n" +"
\n" +"float_optional_exponent_part
\n" +" float_exponent_part .or .true;
\n" +"
\n" +"float_digit_sequence
\n" +" digit_dec .emit * .and .loop digit_dec .emit *;
\n" +"
\n" +"float_exponent_part
\n" +" float_exponent_part_1 .or float_exponent_part_2;
\n" +"float_exponent_part_1
\n" +" 'e' .emit 'e' .and float_optional_sign .and float_digit_sequence;
\n" +"float_exponent_part_2
\n" +" 'E' .emit 'E' .and float_optional_sign .and float_digit_sequence;
\n" +"
\n" +"float_optional_sign
\n" +" '+' .emit '+' .or '-' .emit '-' .or .true;
\n" +"
\n" +"integer
\n" +" integer_hex .or integer_oct .or integer_dec;
\n" +"
\n" +"integer_hex
\n" +" '0' .emit '0' .and integer_hex_1 .emit * .and digit_hex .emit * .and
\n" +" .loop digit_hex .emit *;
\n" +"integer_hex_1
\n" +" 'x' .or 'X';
\n" +"
\n" +"integer_oct
\n" +" '0' .emit '0' .and .loop digit_oct .emit *;
\n" +"
\n" +"integer_dec
\n" +" digit_dec .emit * .and .loop digit_dec .emit *;
\n" +"
\n" +"increment
\n" +" '+' .emit * .and '+' .emit *;
\n" +"
\n" +"decrement
\n" +" '-' .emit * .and '-' .emit *;
\n" +"
\n" +"lequal
\n" +" '<' .emit * .and '=' .emit *;
\n" +"
\n" +"gequal
\n" +" '>' .emit * .and '=' .emit *;
\n" +"
\n" +"equal
\n" +" '=' .emit * .and '=' .emit *;
\n" +"
\n" +"nequal
\n" +" '!' .emit * .and '=' .emit *;
\n" +"
\n" +"and
\n" +" '&' .emit * .and '&' .emit *;
\n" +"
\n" +"xor
\n" +" '^' .emit * .and '^' .emit *;
\n" +"
\n" +"or
\n" +" '|' .emit * .and '|' .emit *;
\n" +"
\n" +"addto
\n" +" '+' .emit * .and '=' .emit *;
\n" +"
\n" +"subtractfrom
\n" +" '-' .emit * .and '=' .emit *;
\n" +"
\n" +"multiplyto
\n" +" '*' .emit * .and '=' .emit *;
\n" +"
\n" +"divideto
\n" +" '/' .emit * .and '=' .emit *;
\n" +"
\n" +"
\n" +"other
\n" +" '\\x24'-'\\xFF' .emit * .or '\\x01'-'\\x22' .emit *;
\n" +"
\n" +"symbol_character
\n" +" 'A'-'Z' .or 'a'-'z' .or '_';
\n" +"
\n" +"symbol_character2
\n" +" 'A'-'Z' .or 'a'-'z' .or '0'-'9' .or '_';
\n" +"
\n" +".string string_lexer;
\n" +"
\n" +"string_lexer
\n" +" lex_first_identifier_character .and .loop lex_next_identifier_character;
\n" +"
\n" +"lex_first_identifier_character
\n" +" 'a'-'z' .or 'A'-'Z' .or '_';
\n" +"
\n" +"lex_next_identifier_character
\n" +" 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
\n" +"
\n" +"" diff --git a/src/mesa/shader/slang/library/slang_pp_expression.syn b/src/mesa/shader/slang/library/slang_pp_expression.syn new file mode 100755 index 00000000000..73d2a05f0a4 --- /dev/null +++ b/src/mesa/shader/slang/library/slang_pp_expression.syn @@ -0,0 +1,265 @@ +/*
+ * Mesa 3-D graphics library
+ * Version: 6.6
+ *
+ * Copyright (C) 2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file slang_pp_expression.syn
+ * slang preprocessor expression parser
+ * \author Michal Krol
+ */
+
+/*
+ * Parses one or two (optional) expressions on literal integer constants. Those expressions come
+ * from #if #elif and #line directives. The preprocessor already parsed those directives and
+ * expanded the expression (expressions). All occurences of the operator "defined" are already
+ * replaced with either "0" or "1" literals.
+ */
+
+.syntax expression;
+
+/*
+ * Those separate individual expressions.
+ * For #if/#elif case it is: EXP_EXPRESSION ... EXP_END
+ * For #line case it may be: EXP_EXPRESSION ... EXP_EXPRESSION ... EXP_END
+ */
+.emtcode EXP_END 0
+.emtcode EXP_EXPRESSION 1
+
+.emtcode OP_END 0
+.emtcode OP_PUSHINT 1
+.emtcode OP_LOGICALOR 2
+.emtcode OP_LOGICALAND 3
+.emtcode OP_OR 4
+.emtcode OP_XOR 5
+.emtcode OP_AND 6
+.emtcode OP_EQUAL 7
+.emtcode OP_NOTEQUAL 8
+.emtcode OP_LESSEQUAL 9
+.emtcode OP_GREATEREQUAL 10
+.emtcode OP_LESS 11
+.emtcode OP_GREATER 12
+.emtcode OP_LEFTSHIFT 13
+.emtcode OP_RIGHTSHIFT 14
+.emtcode OP_ADD 15
+.emtcode OP_SUBTRACT 16
+.emtcode OP_MULTIPLY 17
+.emtcode OP_DIVIDE 18
+.emtcode OP_MODULUS 19
+.emtcode OP_PLUS 20
+.emtcode OP_MINUS 21
+.emtcode OP_NEGATE 22
+.emtcode OP_COMPLEMENT 23
+
+expression
+ first_expression .and optional_second_expression .and optional_space .and '\0' .emit EXP_END;
+
+first_expression
+ optional_space .and logical_or_expression .emit EXP_EXPRESSION .and .true .emit OP_END;
+
+optional_second_expression
+ second_expression .or .true;
+
+second_expression
+ space .and logical_or_expression .emit EXP_EXPRESSION .and .true .emit OP_END;
+
+logical_or_expression
+ logical_and_expression .and .loop logical_or_expression_1;
+logical_or_expression_1
+ barbar .and logical_and_expression .and .true .emit OP_LOGICALOR;
+
+logical_and_expression
+ or_expression .and .loop logical_and_expression_1;
+logical_and_expression_1
+ ampersandampersand .and or_expression .and .true .emit OP_LOGICALAND;
+
+or_expression
+ xor_expression .and .loop or_expression_1;
+or_expression_1
+ bar .and xor_expression .and .true .emit OP_OR;
+
+xor_expression
+ and_expression .and .loop xor_expression_1;
+xor_expression_1
+ caret .and and_expression .and .true .emit OP_XOR;
+
+and_expression
+ equality_expression .and .loop and_expression_1;
+and_expression_1
+ ampersand .and equality_expression .and .true .emit OP_AND;
+
+equality_expression
+ relational_expression .and .loop equality_expression_1;
+equality_expression_1
+ equality_expression_2 .or equality_expression_3;
+equality_expression_2
+ equalsequals .and relational_expression .and .true .emit OP_EQUAL;
+equality_expression_3
+ bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;
+
+relational_expression
+ shift_expression .and .loop relational_expression_1;
+relational_expression_1
+ relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or
+ relational_expression_5;
+relational_expression_2
+ lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;
+relational_expression_3
+ greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;
+relational_expression_4
+ less .and shift_expression .and .true .emit OP_LESS;
+relational_expression_5
+ greater .and shift_expression .and .true .emit OP_GREATER;
+
+shift_expression
+ additive_expression .and .loop shift_expression_1;
+shift_expression_1
+ shift_expression_2 .or shift_expression_3;
+shift_expression_2
+ lessless .and additive_expression .and .true .emit OP_LEFTSHIFT;
+shift_expression_3
+ greatergreater .and additive_expression .and .true .emit OP_RIGHTSHIFT;
+
+additive_expression
+ multiplicative_expression .and .loop additive_expression_1;
+additive_expression_1
+ additive_expression_2 .or additive_expression_3;
+additive_expression_2
+ plus .and multiplicative_expression .and .true .emit OP_ADD;
+additive_expression_3
+ dash .and multiplicative_expression .and .true .emit OP_SUBTRACT;
+
+multiplicative_expression
+ unary_expression .and .loop multiplicative_expression_1;
+multiplicative_expression_1
+ multiplicative_expression_2 .or multiplicative_expression_3 .or multiplicative_expression_4;
+multiplicative_expression_2
+ star .and unary_expression .and .true .emit OP_MULTIPLY;
+multiplicative_expression_3
+ slash .and unary_expression .and .true .emit OP_DIVIDE;
+multiplicative_expression_4
+ percent .and unary_expression .and .true .emit OP_MODULUS;
+
+unary_expression
+ primary_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or
+ unary_expression_4;
+unary_expression_1
+ plus .and unary_expression .and .true .emit OP_PLUS;
+unary_expression_2
+ dash .and unary_expression .and .true .emit OP_MINUS;
+unary_expression_3
+ bang .and unary_expression .and .true .emit OP_NEGATE;
+unary_expression_4
+ tilda .and unary_expression .and .true .emit OP_COMPLEMENT;
+
+primary_expression
+ intconstant .or primary_expression_1;
+primary_expression_1
+ lparen .and logical_or_expression .and rparen;
+
+intconstant
+ integer .emit OP_PUSHINT;
+
+integer
+ integer_dec;
+
+integer_dec
+ digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
+
+digit_dec
+ '0'-'9';
+
+optional_space
+ .loop single_space;
+
+space
+ single_space .and .loop single_space;
+
+single_space
+ ' ' .or '\t';
+
+ampersand
+ optional_space .and '&' .and optional_space;
+
+ampersandampersand
+ optional_space .and '&' .and '&' .and optional_space;
+
+bang
+ optional_space .and '!' .and optional_space;
+
+bangequals
+ optional_space .and '!' .and '=' .and optional_space;
+
+bar
+ optional_space .and '|' .and optional_space;
+
+barbar
+ optional_space .and '|' .and '|' .and optional_space;
+
+caret
+ optional_space .and '^' .and optional_space;
+
+dash
+ 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;
+
+less
+ optional_space .and '<' .and optional_space;
+
+lessequals
+ optional_space .and '<' .and '=' .and optional_space;
+
+lessless
+ optional_space .and '<' .and '<' .and optional_space;
+
+lparen
+ optional_space .and '(' .and optional_space;
+
+percent
+ optional_space .and '%' .and optional_space;
+
+plus
+ optional_space .and '+' .and optional_space;
+
+rparen
+ optional_space .and ')' .and optional_space;
+
+slash
+ optional_space .and '/' .and optional_space;
+
+star
+ optional_space .and '*' .and optional_space;
+
+tilda
+ optional_space .and '~' .and optional_space;
+
diff --git a/src/mesa/shader/slang/library/slang_pp_expression_syn.h b/src/mesa/shader/slang/library/slang_pp_expression_syn.h new file mode 100644 index 00000000000..0fa9c439443 --- /dev/null +++ b/src/mesa/shader/slang/library/slang_pp_expression_syn.h @@ -0,0 +1,234 @@ + +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */ + +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +"
\n" +".syntax expression;
\n" +"
\n" +"
\n" +".emtcode EXP_END 0
\n" +".emtcode EXP_EXPRESSION 1
\n" +"
\n" +".emtcode OP_END 0
\n" +".emtcode OP_PUSHINT 1
\n" +".emtcode OP_LOGICALOR 2
\n" +".emtcode OP_LOGICALAND 3
\n" +".emtcode OP_OR 4
\n" +".emtcode OP_XOR 5
\n" +".emtcode OP_AND 6
\n" +".emtcode OP_EQUAL 7
\n" +".emtcode OP_NOTEQUAL 8
\n" +".emtcode OP_LESSEQUAL 9
\n" +".emtcode OP_GREATEREQUAL 10
\n" +".emtcode OP_LESS 11
\n" +".emtcode OP_GREATER 12
\n" +".emtcode OP_LEFTSHIFT 13
\n" +".emtcode OP_RIGHTSHIFT 14
\n" +".emtcode OP_ADD 15
\n" +".emtcode OP_SUBTRACT 16
\n" +".emtcode OP_MULTIPLY 17
\n" +".emtcode OP_DIVIDE 18
\n" +".emtcode OP_MODULUS 19
\n" +".emtcode OP_PLUS 20
\n" +".emtcode OP_MINUS 21
\n" +".emtcode OP_NEGATE 22
\n" +".emtcode OP_COMPLEMENT 23
\n" +"
\n" +"expression
\n" +" first_expression .and optional_second_expression .and optional_space .and '\\0' .emit EXP_END;
\n" +"
\n" +"first_expression
\n" +" optional_space .and logical_or_expression .emit EXP_EXPRESSION .and .true .emit OP_END;
\n" +"
\n" +"optional_second_expression
\n" +" second_expression .or .true;
\n" +"
\n" +"second_expression
\n" +" space .and logical_or_expression .emit EXP_EXPRESSION .and .true .emit OP_END;
\n" +"
\n" +"logical_or_expression
\n" +" logical_and_expression .and .loop logical_or_expression_1;
\n" +"logical_or_expression_1
\n" +" barbar .and logical_and_expression .and .true .emit OP_LOGICALOR;
\n" +"
\n" +"logical_and_expression
\n" +" or_expression .and .loop logical_and_expression_1;
\n" +"logical_and_expression_1
\n" +" ampersandampersand .and or_expression .and .true .emit OP_LOGICALAND;
\n" +"
\n" +"or_expression
\n" +" xor_expression .and .loop or_expression_1;
\n" +"or_expression_1
\n" +" bar .and xor_expression .and .true .emit OP_OR;
\n" +"
\n" +"xor_expression
\n" +" and_expression .and .loop xor_expression_1;
\n" +"xor_expression_1
\n" +" caret .and and_expression .and .true .emit OP_XOR;
\n" +"
\n" +"and_expression
\n" +" equality_expression .and .loop and_expression_1;
\n" +"and_expression_1
\n" +" ampersand .and equality_expression .and .true .emit OP_AND;
\n" +"
\n" +"equality_expression
\n" +" relational_expression .and .loop equality_expression_1;
\n" +"equality_expression_1
\n" +" equality_expression_2 .or equality_expression_3;
\n" +"equality_expression_2
\n" +" equalsequals .and relational_expression .and .true .emit OP_EQUAL;
\n" +"equality_expression_3
\n" +" bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;
\n" +"
\n" +"relational_expression
\n" +" shift_expression .and .loop relational_expression_1;
\n" +"relational_expression_1
\n" +" relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or
\n" +" relational_expression_5;
\n" +"relational_expression_2
\n" +" lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;
\n" +"relational_expression_3
\n" +" greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;
\n" +"relational_expression_4
\n" +" less .and shift_expression .and .true .emit OP_LESS;
\n" +"relational_expression_5
\n" +" greater .and shift_expression .and .true .emit OP_GREATER;
\n" +"
\n" +"shift_expression
\n" +" additive_expression .and .loop shift_expression_1;
\n" +"shift_expression_1
\n" +" shift_expression_2 .or shift_expression_3;
\n" +"shift_expression_2
\n" +" lessless .and additive_expression .and .true .emit OP_LEFTSHIFT;
\n" +"shift_expression_3
\n" +" greatergreater .and additive_expression .and .true .emit OP_RIGHTSHIFT;
\n" +"
\n" +"additive_expression
\n" +" multiplicative_expression .and .loop additive_expression_1;
\n" +"additive_expression_1
\n" +" additive_expression_2 .or additive_expression_3;
\n" +"additive_expression_2
\n" +" plus .and multiplicative_expression .and .true .emit OP_ADD;
\n" +"additive_expression_3
\n" +" dash .and multiplicative_expression .and .true .emit OP_SUBTRACT;
\n" +"
\n" +"multiplicative_expression
\n" +" unary_expression .and .loop multiplicative_expression_1;
\n" +"multiplicative_expression_1
\n" +" multiplicative_expression_2 .or multiplicative_expression_3 .or multiplicative_expression_4;
\n" +"multiplicative_expression_2
\n" +" star .and unary_expression .and .true .emit OP_MULTIPLY;
\n" +"multiplicative_expression_3
\n" +" slash .and unary_expression .and .true .emit OP_DIVIDE;
\n" +"multiplicative_expression_4
\n" +" percent .and unary_expression .and .true .emit OP_MODULUS;
\n" +"
\n" +"unary_expression
\n" +" primary_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or
\n" +" unary_expression_4;
\n" +"unary_expression_1
\n" +" plus .and unary_expression .and .true .emit OP_PLUS;
\n" +"unary_expression_2
\n" +" dash .and unary_expression .and .true .emit OP_MINUS;
\n" +"unary_expression_3
\n" +" bang .and unary_expression .and .true .emit OP_NEGATE;
\n" +"unary_expression_4
\n" +" tilda .and unary_expression .and .true .emit OP_COMPLEMENT;
\n" +"
\n" +"primary_expression
\n" +" intconstant .or primary_expression_1;
\n" +"primary_expression_1
\n" +" lparen .and logical_or_expression .and rparen;
\n" +"
\n" +"intconstant
\n" +" integer .emit OP_PUSHINT;
\n" +"
\n" +"integer
\n" +" integer_dec;
\n" +"
\n" +"integer_dec
\n" +" digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';
\n" +"
\n" +"digit_dec
\n" +" '0'-'9';
\n" +"
\n" +"optional_space
\n" +" .loop single_space;
\n" +"
\n" +"space
\n" +" single_space .and .loop single_space;
\n" +"
\n" +"single_space
\n" +" ' ' .or '\\t';
\n" +"
\n" +"ampersand
\n" +" optional_space .and '&' .and optional_space;
\n" +"
\n" +"ampersandampersand
\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" +"bar
\n" +" optional_space .and '|' .and optional_space;
\n" +"
\n" +"barbar
\n" +" optional_space .and '|' .and '|' .and optional_space;
\n" +"
\n" +"caret
\n" +" optional_space .and '^' .and optional_space;
\n" +"
\n" +"dash
\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" +"greatergreater
\n" +" optional_space .and '>' .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" +"lessless
\n" +" optional_space .and '<' .and '<' .and optional_space;
\n" +"
\n" +"lparen
\n" +" optional_space .and '(' .and optional_space;
\n" +"
\n" +"percent
\n" +" optional_space .and '%' .and optional_space;
\n" +"
\n" +"plus
\n" +" optional_space .and '+' .and optional_space;
\n" +"
\n" +"rparen
\n" +" optional_space .and ')' .and optional_space;
\n" +"
\n" +"slash
\n" +" optional_space .and '/' .and optional_space;
\n" +"
\n" +"star
\n" +" optional_space .and '*' .and optional_space;
\n" +"
\n" +"tilda
\n" +" optional_space .and '~' .and optional_space;
\n" +"
\n" +"" diff --git a/src/mesa/shader/slang/library/slang_pp_version.syn b/src/mesa/shader/slang/library/slang_pp_version.syn index f48f3ddf0ba..d5e9317b5d4 100644 --- a/src/mesa/shader/slang/library/slang_pp_version.syn +++ b/src/mesa/shader/slang/library/slang_pp_version.syn @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.6 * * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. * @@ -23,7 +23,7 @@ */ /** - * \file slang_version.syn + * \file slang_pp_version.syn * slang #version directive syntax * \author Michal Krol */ diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h index f08c329303c..ad89472ba3b 100644 --- a/src/mesa/shader/slang/library/slang_shader_syn.h +++ b/src/mesa/shader/slang/library/slang_shader_syn.h @@ -1,3 +1,6 @@ + +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */ + ".syntax translation_unit;\n" ".emtcode REVISION 3\n" ".emtcode EXTERNAL_NULL 0\n" |