remove redundant check of parsed program target
[mesa.git] / src / mesa / shader / grammar_syn.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.1
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 /**
26 * \file grammar_syn.h
27 * syntax parsing engine language syntax
28 * \author Michal Krol
29 */
30
31 ".syntax grammar;\n"
32 ".emtcode DECLARATION_END 0x00\n"
33 ".emtcode DECLARATION_EMITCODE 0x01\n"
34 ".emtcode DECLARATION_ERRORTEXT 0x02\n"
35 ".emtcode DECLARATION_REGBYTE 0x03\n"
36 ".emtcode DECLARATION_LEXER 0x04\n"
37 ".emtcode DECLARATION_RULE 0x05\n"
38 ".emtcode SPECIFIER_END 0x00\n"
39 ".emtcode SPECIFIER_AND_TAG 0x01\n"
40 ".emtcode SPECIFIER_OR_TAG 0x02\n"
41 ".emtcode SPECIFIER_CHARACTER_RANGE 0x03\n"
42 ".emtcode SPECIFIER_CHARACTER 0x04\n"
43 ".emtcode SPECIFIER_STRING 0x05\n"
44 ".emtcode SPECIFIER_IDENTIFIER 0x06\n"
45 ".emtcode SPECIFIER_TRUE 0x07\n"
46 ".emtcode SPECIFIER_FALSE 0x08\n"
47 ".emtcode SPECIFIER_DEBUG 0x09\n"
48 ".emtcode IDENTIFIER_NO_LOOP 0x00\n"
49 ".emtcode IDENTIFIER_LOOP 0x01\n"
50 ".emtcode ERROR_NOT_PRESENT 0x00\n"
51 ".emtcode ERROR_PRESENT 0x01\n"
52 ".emtcode EMIT_NULL 0x00\n"
53 ".emtcode EMIT_INTEGER 0x01\n"
54 ".emtcode EMIT_IDENTIFIER 0x02\n"
55 ".emtcode EMIT_CHARACTER 0x03\n"
56 ".emtcode EMIT_LAST_CHARACTER 0x04\n"
57 ".emtcode EMIT_CURRENT_POSITION 0x05\n"
58 ".errtext INVALID_GRAMMAR \"internal error 2001: invalid grammar script\"\n"
59 ".errtext SYNTAX_EXPECTED \"internal error 2002: '.syntax' keyword expected\"\n"
60 ".errtext IDENTIFIER_EXPECTED \"internal error 2003: identifier expected\"\n"
61 ".errtext MISSING_SEMICOLON \"internal error 2004: missing ';'\"\n"
62 ".errtext INTEGER_EXPECTED \"internal error 2005: integer value expected\"\n"
63 ".errtext STRING_EXPECTED \"internal error 2006: string expected\"\n"
64 "grammar\n"
65 " grammar_1 .error INVALID_GRAMMAR;\n"
66 "grammar_1\n"
67 " optional_space .and \".syntax\" .error SYNTAX_EXPECTED .and space .and identifier .and\n"
68 " semicolon .and declaration_list .and optional_space .and '\\0' .emit DECLARATION_END;\n"
69 "optional_space\n"
70 " space .or .true;\n"
71 "space\n"
72 " single_space .and .loop single_space;\n"
73 "single_space\n"
74 " white_char .or comment_block;\n"
75 "white_char\n"
76 " ' ' .or '\\t' .or '\\n' .or '\\r';\n"
77 "comment_block\n"
78 " '/' .and '*' .and .loop comment_char .and '*' .and '/';\n"
79 "comment_char\n"
80 " comment_char_no_star .or comment_char_1;\n"
81 "comment_char_1\n"
82 " '*' .and comment_char_no_slash;\n"
83 "comment_char_no_star\n"
84 " '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
85 "comment_char_no_slash\n"
86 " '\\x30'-'\\xFF' .or '\\x01'-'\\x2E';\n"
87 "identifier\n"
88 " identifier_ne .error IDENTIFIER_EXPECTED;\n"
89 "identifier_ne\n"
90 " first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit '\\0';\n"
91 "first_idchar\n"
92 " 'a'-'z' .or 'A'-'Z' .or '_';\n"
93 "follow_idchar\n"
94 " first_idchar .or digit_dec;\n"
95 "digit_dec\n"
96 " '0'-'9';\n"
97 "semicolon\n"
98 " optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n"
99 "declaration_list\n"
100 " declaration .and .loop declaration;\n"
101 "declaration\n"
102 " emitcode_definition .emit DECLARATION_EMITCODE .or\n"
103 " errortext_definition .emit DECLARATION_ERRORTEXT .or\n"
104 " regbyte_definition .emit DECLARATION_REGBYTE .or\n"
105 " lexer_definition .emit DECLARATION_LEXER .or\n"
106 " rule_definition .emit DECLARATION_RULE;\n"
107 "emitcode_definition\n"
108 " \".emtcode\" .and space .and identifier .and space .and integer .and space_or_null;\n"
109 "integer\n"
110 " integer_ne .error INTEGER_EXPECTED;\n"
111 "integer_ne\n"
112 " hex_prefix .and digit_hex .emit * .and .loop digit_hex .emit * .and .true .emit '\\0';\n"
113 "hex_prefix\n"
114 " '0' .and hex_prefix_1;\n"
115 "hex_prefix_1\n"
116 " 'x' .or 'X';\n"
117 "digit_hex\n"
118 " '0'-'9' .or 'a'-'f' .or 'A'-'F';\n"
119 "space_or_null\n"
120 " space .or '\\0';\n"
121 "errortext_definition\n"
122 " \".errtext\" .and space .and identifier .and space .and string .and space_or_null;\n"
123 "string\n"
124 " string_ne .error STRING_EXPECTED;\n"
125 "string_ne\n"
126 " '\"' .and .loop string_char_double_quotes .and '\"' .emit '\\0';\n"
127 "string_char_double_quotes\n"
128 " escape_sequence .or string_char .emit * .or '\\'' .emit *;\n"
129 "string_char\n"
130 " '\\x5D'-'\\xFF' .or '\\x28'-'\\x5B' .or '\\x23'-'\\x26' .or '\\x0E'-'\\x21' .or '\\x0B'-'\\x0C' .or\n"
131 " '\\x01'-'\\x09';\n"
132 "escape_sequence\n"
133 " '\\\\' .emit * .and escape_code;\n"
134 "escape_code\n"
135 " simple_escape_code .emit * .or hex_escape_code .or oct_escape_code;\n"
136 "simple_escape_code\n"
137 " '\\'' .or '\"' .or '?' .or '\\\\' .or 'a' .or 'b' .or 'f' .or 'n' .or 'r' .or 't' .or 'v';\n"
138 "hex_escape_code\n"
139 " 'x' .emit * .and digit_hex .emit * .and .loop digit_hex .emit *;\n"
140 "oct_escape_code\n"
141 " digit_oct .emit * .and optional_digit_oct .and optional_digit_oct;\n"
142 "digit_oct\n"
143 " '0'-'7';\n"
144 "optional_digit_oct\n"
145 " digit_oct .emit * .or .true;\n"
146 "regbyte_definition\n"
147 " \".regbyte\" .and space .and identifier .and space .and integer .and space_or_null;\n"
148 "lexer_definition\n"
149 " \".string\" .and space .and identifier .and semicolon;\n"
150 "rule_definition\n"
151 " identifier_ne .and space .and definition;\n"
152 "definition\n"
153 " specifier .and optional_specifiers_and_or .and semicolon .emit SPECIFIER_END;\n"
154 "optional_specifiers_and_or\n"
155 " and_specifiers .emit SPECIFIER_AND_TAG .or or_specifiers .emit SPECIFIER_OR_TAG .or .true;\n"
156 "specifier\n"
157 " specifier_condition .and optional_space .and specifier_rule;\n"
158 "specifier_condition\n"
159 " specifier_condition_1 .or .true;\n"
160 "specifier_condition_1\n"
161 " \".if\" .and optional_space .and '(' .and optional_space .and left_operand .and operator .and\n"
162 " right_operand .and optional_space .and ')';\n"
163 "left_operand\n"
164 " identifier;\n"
165 "operator\n"
166 " operator_1 .or operator_2;\n"
167 "operator_1\n"
168 " optional_space .and '!' .and '=' .and optional_space;\n"
169 "operator_2\n"
170 " optional_space .and '=' .and '=' .and optional_space;\n"
171 "right_operand\n"
172 " integer;\n"
173 "specifier_rule\n"
174 " specifier_rule_1 .and optional_error .and .loop emit .and .true .emit EMIT_NULL;\n"
175 "specifier_rule_1\n"
176 " character_range .emit SPECIFIER_CHARACTER_RANGE .or\n"
177 " character .emit SPECIFIER_CHARACTER .or\n"
178 " string_ne .emit SPECIFIER_STRING .or\n"
179 " \".true\" .emit SPECIFIER_TRUE .or\n"
180 " \".false\" .emit SPECIFIER_FALSE .or\n"
181 " \".debug\" .emit SPECIFIER_DEBUG .or\n"
182 " loop_identifier .emit SPECIFIER_IDENTIFIER;\n"
183 "character\n"
184 " '\\'' .and string_char_single_quotes .and '\\'' .emit '\\0';\n"
185 "string_char_single_quotes\n"
186 " escape_sequence .or string_char .emit * .or '\"' .emit *;\n"
187 "character_range\n"
188 " character .and optional_space .and '-' .and optional_space .and character;\n"
189 "loop_identifier\n"
190 " optional_loop .and identifier;\n"
191 "optional_loop\n"
192 " optional_loop_1 .emit IDENTIFIER_LOOP .or .true .emit IDENTIFIER_NO_LOOP;\n"
193 "optional_loop_1\n"
194 " \".loop\" .and space;\n"
195 "optional_error\n"
196 " error .emit ERROR_PRESENT .or .true .emit ERROR_NOT_PRESENT;\n"
197 "error\n"
198 " space .and \".error\" .and space .and identifier;\n"
199 "emit\n"
200 " emit_output .or emit_regbyte;\n"
201 "emit_output\n"
202 " space .and \".emit\" .and space .and emit_param;\n"
203 "emit_param\n"
204 " integer_ne .emit EMIT_INTEGER .or\n"
205 " identifier_ne .emit EMIT_IDENTIFIER .or\n"
206 " character .emit EMIT_CHARACTER .or\n"
207 " '*' .emit EMIT_LAST_CHARACTER .or\n"
208 " '$' .emit EMIT_CURRENT_POSITION;\n"
209 "emit_regbyte\n"
210 " space .and \".load\" .and space .and identifier .and space .and emit_param;\n"
211 "and_specifiers\n"
212 " and_specifier .and .loop and_specifier;\n"
213 "or_specifiers\n"
214 " or_specifier .and .loop or_specifier;\n"
215 "and_specifier\n"
216 " space .and \".and\" .and space .and specifier;\n"
217 "or_specifier\n"
218 " space .and \".or\" .and space .and specifier;\n"
219 ".string __string_filter;\n"
220 "__string_filter\n"
221 " __first_identifier_char .and .loop __next_identifier_char;\n"
222 "__first_identifier_char\n"
223 " 'a'-'z' .or 'A'-'Z' .or '_' .or '.';\n"
224 "__next_identifier_char\n"
225 " 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n"
226 ""