2 * Mesa 3-D graphics library
5 * Copyright (C) 2004-2006 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
26 * \file slang_shader.syn
27 * slang vertex/fragment shader syntax
33 * syn2c slang_shader.syn > slang_shader_syn.h
35 * when modifying or extending this file, several things must be taken into consideration:
36 * - when adding new operators that were marked as reserved in the initial specification,
37 * one must only uncomment particular lines of code that refer to operators being added;
38 * - when adding new shader target, one must reserve new value for shader_type register and
39 * use it in .if constructs for symbols that are exclusive for that shader;
40 * - some symbols mimic output of other symbols - the best example is the "for" construct:
41 * expression "for (foo(); ; bar())" is seen as "for (foo(); true; bar())" by the output
42 * processor - hence, special care must be taken when rearranging output of essential symbols;
43 * - order of single-quoted tokens does matter in alternatives - so do not parse "<" operator
44 * before "<<" and "<<" before "<<=";
45 * - all double-quoted tokens are internally preprocessed to eliminate problems with parsing
46 * strings that are prefixes of other strings, like "sampler1D" and "sampler1DShadow";
49 .syntax translation_unit;
51 /* revision number - increment after each change affecting emitted output */
54 /* external declaration */
55 .emtcode EXTERNAL_NULL 0
56 .emtcode EXTERNAL_FUNCTION_DEFINITION 1
57 .emtcode EXTERNAL_DECLARATION 2
60 .emtcode DECLARATION_FUNCTION_PROTOTYPE 1
61 .emtcode DECLARATION_INIT_DECLARATOR_LIST 2
64 .emtcode FUNCTION_ORDINARY 0
65 .emtcode FUNCTION_CONSTRUCTOR 1
66 .emtcode FUNCTION_OPERATOR 2
69 .emtcode OPERATOR_ADDASSIGN 1
70 .emtcode OPERATOR_SUBASSIGN 2
71 .emtcode OPERATOR_MULASSIGN 3
72 .emtcode OPERATOR_DIVASSIGN 4
73 /*.emtcode OPERATOR_MODASSIGN 5*/
74 /*.emtcode OPERATOR_LSHASSIGN 6*/
75 /*.emtcode OPERATOR_RSHASSIGN 7*/
76 /*.emtcode OPERATOR_ORASSIGN 8*/
77 /*.emtcode OPERATOR_XORASSIGN 9*/
78 /*.emtcode OPERATOR_ANDASSIGN 10*/
79 .emtcode OPERATOR_LOGICALXOR 11
80 /*.emtcode OPERATOR_BITOR 12*/
81 /*.emtcode OPERATOR_BITXOR 13*/
82 /*.emtcode OPERATOR_BITAND 14*/
83 .emtcode OPERATOR_LESS 15
84 .emtcode OPERATOR_GREATER 16
85 .emtcode OPERATOR_LESSEQUAL 17
86 .emtcode OPERATOR_GREATEREQUAL 18
87 /*.emtcode OPERATOR_LSHIFT 19*/
88 /*.emtcode OPERATOR_RSHIFT 20*/
89 .emtcode OPERATOR_MULTIPLY 21
90 .emtcode OPERATOR_DIVIDE 22
91 /*.emtcode OPERATOR_MODULUS 23*/
92 .emtcode OPERATOR_INCREMENT 24
93 .emtcode OPERATOR_DECREMENT 25
94 .emtcode OPERATOR_PLUS 26
95 .emtcode OPERATOR_MINUS 27
96 /*.emtcode OPERATOR_COMPLEMENT 28*/
97 .emtcode OPERATOR_NOT 29
99 /* init declarator list */
100 .emtcode DECLARATOR_NONE 0
101 .emtcode DECLARATOR_NEXT 1
103 /* variable declaration */
104 .emtcode VARIABLE_NONE 0
105 .emtcode VARIABLE_IDENTIFIER 1
106 .emtcode VARIABLE_INITIALIZER 2
107 .emtcode VARIABLE_ARRAY_EXPLICIT 3
108 .emtcode VARIABLE_ARRAY_UNKNOWN 4
111 .emtcode TYPE_QUALIFIER_NONE 0
112 .emtcode TYPE_QUALIFIER_CONST 1
113 .emtcode TYPE_QUALIFIER_ATTRIBUTE 2
114 .emtcode TYPE_QUALIFIER_VARYING 3
115 .emtcode TYPE_QUALIFIER_UNIFORM 4
116 .emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5
117 .emtcode TYPE_QUALIFIER_FIXEDINPUT 6
120 .emtcode TYPE_SPECIFIER_VOID 0
121 .emtcode TYPE_SPECIFIER_BOOL 1
122 .emtcode TYPE_SPECIFIER_BVEC2 2
123 .emtcode TYPE_SPECIFIER_BVEC3 3
124 .emtcode TYPE_SPECIFIER_BVEC4 4
125 .emtcode TYPE_SPECIFIER_INT 5
126 .emtcode TYPE_SPECIFIER_IVEC2 6
127 .emtcode TYPE_SPECIFIER_IVEC3 7
128 .emtcode TYPE_SPECIFIER_IVEC4 8
129 .emtcode TYPE_SPECIFIER_FLOAT 9
130 .emtcode TYPE_SPECIFIER_VEC2 10
131 .emtcode TYPE_SPECIFIER_VEC3 11
132 .emtcode TYPE_SPECIFIER_VEC4 12
133 .emtcode TYPE_SPECIFIER_MAT2 13
134 .emtcode TYPE_SPECIFIER_MAT3 14
135 .emtcode TYPE_SPECIFIER_MAT4 15
136 .emtcode TYPE_SPECIFIER_SAMPLER1D 16
137 .emtcode TYPE_SPECIFIER_SAMPLER2D 17
138 .emtcode TYPE_SPECIFIER_SAMPLER3D 18
139 .emtcode TYPE_SPECIFIER_SAMPLERCUBE 19
140 .emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20
141 .emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21
142 .emtcode TYPE_SPECIFIER_SAMPLER2DRECT 22
143 .emtcode TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23
144 .emtcode TYPE_SPECIFIER_STRUCT 24
145 .emtcode TYPE_SPECIFIER_TYPENAME 25
147 /* structure field */
148 .emtcode FIELD_NONE 0
149 .emtcode FIELD_NEXT 1
150 .emtcode FIELD_ARRAY 2
154 .emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1
155 .emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2
156 .emtcode OP_DECLARE 3
159 .emtcode OP_CONTINUE 6
160 .emtcode OP_DISCARD 7
162 .emtcode OP_EXPRESSION 9
167 .emtcode OP_PUSH_VOID 14
168 .emtcode OP_PUSH_BOOL 15
169 .emtcode OP_PUSH_INT 16
170 .emtcode OP_PUSH_FLOAT 17
171 .emtcode OP_PUSH_IDENTIFIER 18
172 .emtcode OP_SEQUENCE 19
173 .emtcode OP_ASSIGN 20
174 .emtcode OP_ADDASSIGN 21
175 .emtcode OP_SUBASSIGN 22
176 .emtcode OP_MULASSIGN 23
177 .emtcode OP_DIVASSIGN 24
178 /*.emtcode OP_MODASSIGN 25*/
179 /*.emtcode OP_LSHASSIGN 26*/
180 /*.emtcode OP_RSHASSIGN 27*/
181 /*.emtcode OP_ORASSIGN 28*/
182 /*.emtcode OP_XORASSIGN 29*/
183 /*.emtcode OP_ANDASSIGN 30*/
184 .emtcode OP_SELECT 31
185 .emtcode OP_LOGICALOR 32
186 .emtcode OP_LOGICALXOR 33
187 .emtcode OP_LOGICALAND 34
188 /*.emtcode OP_BITOR 35*/
189 /*.emtcode OP_BITXOR 36*/
190 /*.emtcode OP_BITAND 37*/
192 .emtcode OP_NOTEQUAL 39
194 .emtcode OP_GREATER 41
195 .emtcode OP_LESSEQUAL 42
196 .emtcode OP_GREATEREQUAL 43
197 /*.emtcode OP_LSHIFT 44*/
198 /*.emtcode OP_RSHIFT 45*/
200 .emtcode OP_SUBTRACT 47
201 .emtcode OP_MULTIPLY 48
202 .emtcode OP_DIVIDE 49
203 /*.emtcode OP_MODULUS 50*/
204 .emtcode OP_PREINCREMENT 51
205 .emtcode OP_PREDECREMENT 52
208 /*.emtcode OP_COMPLEMENT 55*/
210 .emtcode OP_SUBSCRIPT 57
213 .emtcode OP_POSTINCREMENT 60
214 .emtcode OP_POSTDECREMENT 61
216 /* parameter qualifier */
217 .emtcode PARAM_QUALIFIER_IN 0
218 .emtcode PARAM_QUALIFIER_OUT 1
219 .emtcode PARAM_QUALIFIER_INOUT 2
221 /* function parameter */
222 .emtcode PARAMETER_NONE 0
223 .emtcode PARAMETER_NEXT 1
225 /* function parameter array presence */
226 .emtcode PARAMETER_ARRAY_NOT_PRESENT 0
227 .emtcode PARAMETER_ARRAY_PRESENT 1
229 .errtext INVALID_EXTERNAL_DECLARATION "2001: Invalid external declaration."
230 .errtext INVALID_OPERATOR_OVERRIDE "2002: Invalid operator override."
231 .errtext LBRACE_EXPECTED "2003: '{' expected but '$err_token$' found."
232 .errtext LPAREN_EXPECTED "2004: '(' expected but '$err_token$' found."
233 .errtext RPAREN_EXPECTED "2005: ')' expected but '$err_token$' found."
235 /* tells whether the shader that is being parsed is a built-in shader or not */
236 /* 0 - normal behaviour */
237 /* 1 - accepts constructor and operator definitions and __asm statements */
238 /* the implementation will set it to 1 when compiling internal built-in shaders */
239 .regbyte parsing_builtin 0
241 /* holds the type of the shader being parsed; possible values are listed below */
242 /* FRAGMENT_SHADER 1 */
243 /* VERTEX_SHADER 2 */
244 /* shader type is set by the caller before parsing */
245 .regbyte shader_type 0
248 <variable_identifier> ::= <identifier>
251 identifier .emit OP_PUSH_IDENTIFIER;
254 <primary_expression> ::= <variable_identifier>
258 | "(" <expression> ")"
261 floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;
263 lparen .and expression .and rparen;
266 <postfix_expression> ::= <primary_expression>
267 | <postfix_expression> "[" <integer_expression> "]"
269 | <postfix_expression> "." <field_selection>
270 | <postfix_expression> "++"
271 | <postfix_expression> "--"
274 postfix_expression_1 .and .loop postfix_expression_2;
276 function_call .or primary_expression;
278 postfix_expression_3 .or postfix_expression_4 .or
279 plusplus .emit OP_POSTINCREMENT .or
280 minusminus .emit OP_POSTDECREMENT;
282 lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;
284 dot .and field_selection .emit OP_FIELD;
287 <integer_expression> ::= <expression>
293 <function_call> ::= <function_call_generic>
296 function_call_generic .emit OP_CALL .and .true .emit OP_END;
299 <function_call_generic> ::= <function_call_header_with_parameters> ")"
300 | <function_call_header_no_parameters> ")"
302 function_call_generic
303 function_call_generic_1 .or function_call_generic_2;
304 function_call_generic_1
305 function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;
306 function_call_generic_2
307 function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;
310 <function_call_header_no_parameters>::= <function_call_header> "void"
311 | <function_call_header>
313 function_call_header_no_parameters
314 function_call_header .and function_call_header_no_parameters_1;
315 function_call_header_no_parameters_1
319 <function_call_header_with_parameters>::= <function_call_header> <assignment_expression>
320 | <function_call_header_with_parameters> ","
321 <assignment_expression>
323 function_call_header_with_parameters
324 function_call_header .and assignment_expression .and .true .emit OP_END .and
325 .loop function_call_header_with_parameters_1;
326 function_call_header_with_parameters_1
327 comma .and assignment_expression .and .true .emit OP_END;
330 <function_call_header> ::= <function_identifier> "("
333 function_identifier .and lparen;
336 <function_identifier> ::= <constructor_identifier>
339 note: <constructor_identifier> has been deleted
345 <unary_expression> ::= <postfix_expression>
346 | "++" <unary_expression>
347 | "--" <unary_expression>
348 | <unary_operator> <unary_expression>
350 <unary_operator> ::= "+"
356 postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or
357 unary_expression_4 .or unary_expression_5/* .or unary_expression_6*/;
359 plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;
361 minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;
363 plus .and unary_expression .and .true .emit OP_PLUS;
365 minus .and unary_expression .and .true .emit OP_MINUS;
367 bang .and unary_expression .and .true .emit OP_NOT;
369 tilde .and unary_expression .and .true .emit OP_COMPLEMENT;*/
372 <multiplicative_expression> ::= <unary_expression>
373 | <multiplicative_expression> "*" <unary_expression>
374 | <multiplicative_expression> "/" <unary_expression>
375 | <multiplicative_expression> "%" <unary_expression> // reserved
377 multiplicative_expression
378 unary_expression .and .loop multiplicative_expression_1;
379 multiplicative_expression_1
380 multiplicative_expression_2 .or multiplicative_expression_3/* .or multiplicative_expression_4*/;
381 multiplicative_expression_2
382 star .and unary_expression .and .true .emit OP_MULTIPLY;
383 multiplicative_expression_3
384 slash .and unary_expression .and .true .emit OP_DIVIDE;
385 /*multiplicative_expression_4
386 percent .and unary_expression .and .true .emit OP_MODULUS;*/
389 <additive_expression> ::= <multiplicative_expression>
390 | <additive_expression> "+" <multiplicative_expression>
391 | <additive_expression> "-" <multiplicative_expression>
394 multiplicative_expression .and .loop additive_expression_1;
395 additive_expression_1
396 additive_expression_2 .or additive_expression_3;
397 additive_expression_2
398 plus .and multiplicative_expression .and .true .emit OP_ADD;
399 additive_expression_3
400 minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;
403 <shift_expression> ::= <additive_expression>
404 | <shift_expression> "<<" <additive_expression> // reserved
405 | <shift_expression> ">>" <additive_expression> // reserved
408 additive_expression/* .and .loop shift_expression_1*/;
410 shift_expression_2 .or shift_expression_3;*/
412 lessless .and additive_expression .and .true .emit OP_LSHIFT;*/
414 greatergreater .and additive_expression .and .true .emit OP_RSHIFT;*/
417 <relational_expression> ::= <shift_expression>
418 | <relational_expression> "<" <shift_expression>
419 | <relational_expression> ">" <shift_expression>
420 | <relational_expression> "<=" <shift_expression>
421 | <relational_expression> ">=" <shift_expression>
423 relational_expression
424 shift_expression .and .loop relational_expression_1;
425 relational_expression_1
426 relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or
427 relational_expression_5;
428 relational_expression_2
429 lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;
430 relational_expression_3
431 greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;
432 relational_expression_4
433 less .and shift_expression .and .true .emit OP_LESS;
434 relational_expression_5
435 greater .and shift_expression .and .true .emit OP_GREATER;
438 <equality_expression> ::= <relational_expression>
439 | <equality_expression> "==" <relational_expression>
440 | <equality_expression> "!=" <relational_expression>
443 relational_expression .and .loop equality_expression_1;
444 equality_expression_1
445 equality_expression_2 .or equality_expression_3;
446 equality_expression_2
447 equalsequals .and relational_expression .and .true .emit OP_EQUAL;
448 equality_expression_3
449 bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;
452 <and_expression> ::= <equality_expression>
453 | <and_expression> "&" <equality_expression> // reserved
456 equality_expression/* .and .loop and_expression_1*/;
458 ampersand .and equality_expression .and .true .emit OP_BITAND;*/
461 <exclusive_or_expression> ::= <and_expression>
462 | <exclusive_or_expression> "^" <and_expression> // reserved
464 exclusive_or_expression
465 and_expression/* .and .loop exclusive_or_expression_1*/;
466 /*exclusive_or_expression_1
467 caret .and and_expression .and .true .emit OP_BITXOR;*/
470 <inclusive_or_expression> ::= <exclusive_or_expression>
471 | <inclusive_or_expression> "|" <exclusive_or_expression> // reserved
473 inclusive_or_expression
474 exclusive_or_expression/* .and .loop inclusive_or_expression_1*/;
475 /*inclusive_or_expression_1
476 bar .and exclusive_or_expression .and .true .emit OP_BITOR;*/
479 <logical_and_expression> ::= <inclusive_or_expression>
480 | <logical_and_expression> "&&" <inclusive_or_expression>
482 logical_and_expression
483 inclusive_or_expression .and .loop logical_and_expression_1;
484 logical_and_expression_1
485 ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;
488 <logical_xor_expression> ::= <logical_and_expression>
489 | <logical_xor_expression> "^^" <logical_and_expression>
491 logical_xor_expression
492 logical_and_expression .and .loop logical_xor_expression_1;
493 logical_xor_expression_1
494 caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;
497 <logical_or_expression> ::= <logical_xor_expression>
498 | <logical_or_expression> "||" <logical_xor_expression>
500 logical_or_expression
501 logical_xor_expression .and .loop logical_or_expression_1;
502 logical_or_expression_1
503 barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;
506 <conditional_expression> ::= <logical_or_expression>
507 | <logical_or_expression> "?" <expression> ":"
508 <conditional_expression>
510 conditional_expression
511 logical_or_expression .and .loop conditional_expression_1;
512 conditional_expression_1
513 question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;
516 <assignment_expression> ::= <conditional_expression>
517 | <unary_expression> <assignment_operator>
518 <assignment_expression>
520 <assignment_operator> ::= "="
532 assignment_expression
533 assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or
534 assignment_expression_4 .or assignment_expression_5/* .or assignment_expression_6 .or
535 assignment_expression_7 .or assignment_expression_8 .or assignment_expression_9 .or
536 assignment_expression_10 .or assignment_expression_11*/ .or conditional_expression;
537 assignment_expression_1
538 unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;
539 assignment_expression_2
540 unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;
541 assignment_expression_3
542 unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;
543 assignment_expression_4
544 unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;
545 assignment_expression_5
546 unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;
547 /*assignment_expression_6
548 unary_expression .and percentequals .and assignment_expression .and .true .emit OP_MODASSIGN;*/
549 /*assignment_expression_7
550 unary_expression .and lesslessequals .and assignment_expression .and .true .emit OP_LSHASSIGN;*/
551 /*assignment_expression_8
552 unary_expression .and greatergreaterequals .and assignment_expression .and
553 .true .emit OP_RSHASSIGN;*/
554 /*assignment_expression_9
555 unary_expression .and ampersandequals .and assignment_expression .and .true .emit OP_ANDASSIGN;*/
556 /*assignment_expression_10
557 unary_expression .and caretequals .and assignment_expression .and .true .emit OP_XORASSIGN;*/
558 /*assignment_expression_11
559 unary_expression .and barequals .and assignment_expression .and .true .emit OP_ORASSIGN;*/
562 <expression> ::= <assignment_expression>
563 | <expression> "," <assignment_expression>
566 assignment_expression .and .loop expression_1;
568 comma .and assignment_expression .and .true .emit OP_SEQUENCE;
571 <constant_expression> ::= <conditional_expression>
574 conditional_expression .and .true .emit OP_END;
577 <declaration> ::= <function_prototype> ";"
578 | <init_declarator_list> ";"
581 declaration_1 .or declaration_2;
583 function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;
585 init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;
588 <function_prototype> ::= <function_header> "void" ")"
589 | <function_declarator> ")"
592 function_prototype_1 .or function_prototype_2;
594 function_header .and "void" .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;
596 function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;
599 <function_declarator> ::= <function_header>
600 | <function_header_with_parameters>
603 function_header_with_parameters .or function_header;
606 <function_header_with_parameters> ::= <function_header> <parameter_declaration>
607 | <function_header_with_parameters> ","
608 <parameter_declaration>
610 function_header_with_parameters
611 function_header .and parameter_declaration .and .loop function_header_with_parameters_1;
612 function_header_with_parameters_1
613 comma .and parameter_declaration;
616 <function_header> ::= <fully_specified_type> <identifier> "("
619 function_header_nospace .or function_header_space;
620 function_header_space
621 fully_specified_type_space .and space .and function_decl_identifier .and lparen;
622 function_header_nospace
623 fully_specified_type_nospace .and function_decl_identifier .and lparen;
626 <function_decl_identifier> ::= "__constructor"
630 note: this is an extension to the standard language specification - normally slang disallows
631 operator and constructor prototypes and definitions
633 function_decl_identifier
634 .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or
635 .if (parsing_builtin != 0) "__constructor" .emit FUNCTION_CONSTRUCTOR .or
636 identifier .emit FUNCTION_ORDINARY;
639 <__operator> ::= "__operator" <overriden_op>
641 note: this is an extension to the standard language specification - normally slang disallows
642 operator prototypes and definitions
645 "__operator" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;
648 <overriden_op> ::= "="
681 note: this is an extension to the standard language specification - normally slang disallows
682 operator prototypes and definitions
685 plusplus .emit OPERATOR_INCREMENT .or
686 plusequals .emit OPERATOR_ADDASSIGN .or
687 plus .emit OPERATOR_PLUS .or
688 minusminus .emit OPERATOR_DECREMENT .or
689 minusequals .emit OPERATOR_SUBASSIGN .or
690 minus .emit OPERATOR_MINUS .or
691 bang .emit OPERATOR_NOT .or
692 starequals .emit OPERATOR_MULASSIGN .or
693 star .emit OPERATOR_MULTIPLY .or
694 slashequals .emit OPERATOR_DIVASSIGN .or
695 slash .emit OPERATOR_DIVIDE .or
696 lessequals .emit OPERATOR_LESSEQUAL .or
697 /*lesslessequals .emit OPERATOR_LSHASSIGN .or*/
698 /*lessless .emit OPERATOR_LSHIFT .or*/
699 less .emit OPERATOR_LESS .or
700 greaterequals .emit OPERATOR_GREATEREQUAL .or
701 /*greatergreaterequals .emit OPERATOR_RSHASSIGN .or*/
702 /*greatergreater .emit OPERATOR_RSHIFT .or*/
703 greater .emit OPERATOR_GREATER .or
704 /*percentequals .emit OPERATOR_MODASSIGN .or*/
705 /*percent .emit OPERATOR_MODULUS .or*/
706 /*ampersandequals .emit OPERATOR_ANDASSIGN */
707 /*ampersand .emit OPERATOR_BITAND .or*/
708 /*barequals .emit OPERATOR_ORASSIGN .or*/
709 /*bar .emit OPERATOR_BITOR .or*/
710 /*tilde .emit OPERATOR_COMPLEMENT .or*/
711 /*caretequals .emit OPERATOR_XORASSIGN .or*/
712 caretcaret .emit OPERATOR_LOGICALXOR /*.or
713 caret .emit OPERATOR_BITXOR*/;
716 <parameter_declarator> ::= <type_specifier> <identifier>
717 | <type_specifier> <identifier> "[" <constant_expression>
721 parameter_declarator_nospace .or parameter_declarator_space;
722 parameter_declarator_nospace
723 type_specifier_nospace .and identifier .and parameter_declarator_1;
724 parameter_declarator_space
725 type_specifier_space .and space .and identifier .and parameter_declarator_1;
726 parameter_declarator_1
727 parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or
728 .true .emit PARAMETER_ARRAY_NOT_PRESENT;
729 parameter_declarator_2
730 lbracket .and constant_expression .and rbracket;
733 <parameter_declaration> ::= <type_qualifier> <parameter_qualifier>
734 <parameter_declarator>
735 | <type_qualifier> <parameter_qualifier>
736 <parameter_type_specifier>
737 | <parameter_qualifier> <parameter_declarator>
738 | <parameter_qualifier> <parameter_type_specifier>
740 parameter_declaration
741 parameter_declaration_1 .emit PARAMETER_NEXT;
742 parameter_declaration_1
743 parameter_declaration_2 .or parameter_declaration_3;
744 parameter_declaration_2
745 type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;
746 parameter_declaration_3
747 parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;
748 parameter_declaration_4
749 parameter_declarator .or parameter_type_specifier;
752 <parameter_qualifier> ::= "in"
758 parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;
759 parameter_qualifier_1
760 parameter_qualifier_2 .and space;
761 parameter_qualifier_2
762 "in" .emit PARAM_QUALIFIER_IN .or
763 "out" .emit PARAM_QUALIFIER_OUT .or
764 "inout" .emit PARAM_QUALIFIER_INOUT;
767 <parameter_type_specifier> ::= <type_specifier>
768 | <type_specifier> "[" <constant_expression> "]"
770 parameter_type_specifier
771 parameter_type_specifier_1 .and .true .emit '\0' .and parameter_type_specifier_2;
772 parameter_type_specifier_1
773 type_specifier_nospace .or type_specifier_space;
774 parameter_type_specifier_2
775 parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or
776 .true .emit PARAMETER_ARRAY_NOT_PRESENT;
777 parameter_type_specifier_3
778 lbracket .and constant_expression .and rbracket;
781 <init_declarator_list> ::= <single_declaration>
782 | <init_declarator_list> "," <identifier>
783 | <init_declarator_list> "," <identifier> "[" "]"
784 | <init_declarator_list> "," <identifier> "["
785 <constant_expression> "]"
786 | <init_declarator_list> "," <identifier> "="
790 single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and
791 .true .emit DECLARATOR_NONE;
792 init_declarator_list_1
793 comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;
794 init_declarator_list_2
795 init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;
796 init_declarator_list_3
797 equals .and initializer .emit VARIABLE_INITIALIZER;
798 init_declarator_list_4
799 lbracket .and init_declarator_list_5 .and rbracket;
800 init_declarator_list_5
801 constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;
804 <single_declaration> ::= <fully_specified_type>
805 | <fully_specified_type> <identifier>
806 | <fully_specified_type> <identifier> "[" "]"
807 | <fully_specified_type> <identifier> "["
808 <constant_expression> "]"
809 | <fully_specified_type> <identifier> "=" <initializer>
812 single_declaration_nospace .or single_declaration_space;
813 single_declaration_space
814 fully_specified_type_space .and single_declaration_space_1;
815 single_declaration_nospace
816 fully_specified_type_nospace .and single_declaration_nospace_1;
817 single_declaration_space_1
818 single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
819 single_declaration_nospace_1
820 single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
821 single_declaration_space_2
822 space .and identifier .and single_declaration_3;
823 single_declaration_nospace_2
824 identifier .and single_declaration_3;
826 single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;
828 equals .and initializer .emit VARIABLE_INITIALIZER;
830 lbracket .and single_declaration_6 .and rbracket;
832 constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;
835 <fully_specified_type> ::= <type_specifier>
836 | <type_qualifier> <type_specifier>
838 fully_specified_type_space
839 fully_specified_type_1 .and type_specifier_space;
840 fully_specified_type_nospace
841 fully_specified_type_1 .and type_specifier_nospace;
842 fully_specified_type_1
843 fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;
844 fully_specified_type_2
845 type_qualifier .and space;
848 <type_qualifier> ::= "const"
849 | "attribute" // Vertex only.
855 note: this is an extension to the standard language specification - normally slang disallows
856 __fixed_output and __fixed_input type qualifiers
859 "const" .emit TYPE_QUALIFIER_CONST .or
860 .if (shader_type == 2) "attribute" .emit TYPE_QUALIFIER_ATTRIBUTE .or
861 "varying" .emit TYPE_QUALIFIER_VARYING .or
862 "uniform" .emit TYPE_QUALIFIER_UNIFORM .or
863 .if (parsing_builtin != 0) "__fixed_output" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or
864 .if (parsing_builtin != 0) "__fixed_input" .emit TYPE_QUALIFIER_FIXEDINPUT;
867 <type_specifier> ::= "void"
890 | "sampler2DRectShadow"
895 "void" .emit TYPE_SPECIFIER_VOID .or
896 "float" .emit TYPE_SPECIFIER_FLOAT .or
897 "int" .emit TYPE_SPECIFIER_INT .or
898 "bool" .emit TYPE_SPECIFIER_BOOL .or
899 "vec2" .emit TYPE_SPECIFIER_VEC2 .or
900 "vec3" .emit TYPE_SPECIFIER_VEC3 .or
901 "vec4" .emit TYPE_SPECIFIER_VEC4 .or
902 "bvec2" .emit TYPE_SPECIFIER_BVEC2 .or
903 "bvec3" .emit TYPE_SPECIFIER_BVEC3 .or
904 "bvec4" .emit TYPE_SPECIFIER_BVEC4 .or
905 "ivec2" .emit TYPE_SPECIFIER_IVEC2 .or
906 "ivec3" .emit TYPE_SPECIFIER_IVEC3 .or
907 "ivec4" .emit TYPE_SPECIFIER_IVEC4 .or
908 "mat2" .emit TYPE_SPECIFIER_MAT2 .or
909 "mat3" .emit TYPE_SPECIFIER_MAT3 .or
910 "mat4" .emit TYPE_SPECIFIER_MAT4 .or
911 "sampler1D" .emit TYPE_SPECIFIER_SAMPLER1D .or
912 "sampler2D" .emit TYPE_SPECIFIER_SAMPLER2D .or
913 "sampler3D" .emit TYPE_SPECIFIER_SAMPLER3D .or
914 "samplerCube" .emit TYPE_SPECIFIER_SAMPLERCUBE .or
915 "sampler1DShadow" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or
916 "sampler2DShadow" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or
917 "sampler2DRect" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or
918 "sampler2DRectShadow" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW .or
919 type_name .emit TYPE_SPECIFIER_TYPENAME;
920 type_specifier_nospace
921 struct_specifier .emit TYPE_SPECIFIER_STRUCT;
924 <struct_specifier> ::= "struct" <identifier> "{" <struct_declaration_list> "}"
925 | "struct" "{" <struct_declaration_list> "}"
928 "struct" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and
929 struct_declaration_list .and rbrace .emit FIELD_NONE;
931 struct_specifier_2 .or .true .emit '\0';
933 space .and identifier;
936 <struct_declaration_list> ::= <struct_declaration>
937 | <struct_declaration_list> <struct_declaration>
939 struct_declaration_list
940 struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;
943 <struct_declaration> ::= <type_specifier> <struct_declarator_list> ";"
946 struct_declaration_nospace .or struct_declaration_space;
947 struct_declaration_space
948 type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;
949 struct_declaration_nospace
950 type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;
953 <struct_declarator_list> ::= <struct_declarator>
954 | <struct_declarator_list> "," <struct_declarator>
956 struct_declarator_list
957 struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;
958 struct_declarator_list_1
959 comma .and struct_declarator;
962 <struct_declarator> ::= <identifier>
963 | <identifier> "[" <constant_expression> "]"
966 identifier .and struct_declarator_1;
968 struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;
970 lbracket .and constant_expression .and rbracket;
973 <initializer> ::= <assignment_expression>
976 assignment_expression .and .true .emit OP_END;
979 <declaration_statement> ::= <declaration>
981 declaration_statement
985 <statement> ::= <compound_statement>
989 compound_statement .or simple_statement;
991 compound_statement .or statement_space_1;
993 space .and simple_statement;
996 <simple_statement> ::= <__asm_statement>
997 | <selection_statement>
998 | <iteration_statement>
1000 | <expression_statement>
1001 | <declaration_statement>
1003 note: this is an extension to the standard language specification - normally slang disallows
1004 use of __asm statements
1007 .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or
1008 selection_statement .or
1009 iteration_statement .or
1011 expression_statement .emit OP_EXPRESSION .or
1012 declaration_statement .emit OP_DECLARE;
1015 <compound_statement> ::= "{" "}"
1016 | "{" <statement_list> "}"
1019 compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;
1020 compound_statement_1
1021 compound_statement_2 .or compound_statement_3;
1022 compound_statement_2
1024 compound_statement_3
1025 lbrace .and statement_list .and rbrace;
1028 <statement_no_new_scope> ::= <compound_statement_no_new_scope>
1029 | <simple_statement>
1031 statement_no_new_scope
1032 compound_statement_no_new_scope .or simple_statement;
1035 <compound_statement_no_new_scope> ::= "{" "}"
1036 | "{" <statement_list> "}"
1038 compound_statement_no_new_scope
1039 compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;
1040 compound_statement_no_new_scope_1
1041 compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;
1042 compound_statement_no_new_scope_2
1044 compound_statement_no_new_scope_3
1045 lbrace .and statement_list .and rbrace;
1048 <statement_list> ::= <statement>
1049 | <statement_list> <statement>
1052 statement .and .loop statement;
1055 <expression_statement> ::= ";"
1058 expression_statement
1059 expression_statement_1 .or expression_statement_2;
1060 expression_statement_1
1061 semicolon .emit OP_PUSH_VOID .emit OP_END;
1062 expression_statement_2
1063 expression .and semicolon .emit OP_END;
1066 <selection_statement> ::= "if" "(" <expression> ")" <selection_rest_statement>
1069 "if" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and
1070 rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;
1073 <selection_rest_statement> ::= <statement> "else" <statement>
1076 selection_rest_statement
1077 statement .and selection_rest_statement_1;
1078 selection_rest_statement_1
1079 selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;
1080 selection_rest_statement_2
1081 "else" .and optional_space .and statement;
1084 <condition> ::= <expression>
1085 | <fully_specified_type> <identifier> "=" <initializer>
1087 note: if <condition_1> is executed, the emit format must match <declaration> emit format
1090 condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or
1091 condition_3 .emit OP_EXPRESSION;
1093 condition_1_nospace .or condition_1_space;
1095 fully_specified_type_nospace .and condition_2;
1097 fully_specified_type_space .and space .and condition_2;
1099 identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and
1100 initializer .and .true .emit DECLARATOR_NONE;
1102 expression .and .true .emit OP_END;
1105 <iteration_statement> ::= "while" "(" <condition> ")" <statement>
1106 | "do" <statement> "while" "(" <expression> ")" ";"
1107 | "for" "(" <for_init_statement> <for_rest_statement> ")"
1108 <statement_no_new_scope>
1111 iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;
1112 iteration_statement_1
1113 "while" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and
1114 rparen .error RPAREN_EXPECTED .and statement;
1115 iteration_statement_2
1116 "do" .emit OP_DO .and statement_space .and "while" .and lparen .error LPAREN_EXPECTED .and
1117 expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;
1118 iteration_statement_3
1119 "for" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and
1120 for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;
1123 <for_init_statement> ::= <expression_statement>
1124 | <declaration_statement>
1127 expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;
1130 <conditionopt> ::= <condition>
1133 note: <conditionopt> is used only by "for" statement - if <condition> is ommitted, parser
1134 simulates default behaviour, that is simulates "true" expression
1138 .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\0' .emit OP_END;
1141 <for_rest_statement> ::= <conditionopt> ";"
1142 | <conditionopt> ";" <expression>
1145 conditionopt .and semicolon .and for_rest_statement_1;
1146 for_rest_statement_1
1147 for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;
1148 for_rest_statement_2
1149 expression .and .true .emit OP_END;
1152 <jump_statement> ::= "continue" ";"
1155 | "return" <expression> ";"
1156 | "discard" ";" // Fragment shader only.
1159 jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or
1160 .if (shader_type == 1) jump_statement_5;
1162 "continue" .and semicolon .emit OP_CONTINUE;
1164 "break" .and semicolon .emit OP_BREAK;
1166 "return" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;
1168 "return" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;
1170 "discard" .and semicolon .emit OP_DISCARD;
1173 <__asm_statement> ::= "__asm" <identifier> <asm_arguments> ";"
1175 note: this is an extension to the standard language specification - normally slang disallows
1179 "__asm" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;
1182 <asm_arguments> ::= <asm_argument>
1183 | <asm_arguments> "," <asm_argument>
1185 note: this is an extension to the standard language specification - normally slang disallows
1189 asm_argument .and .true .emit OP_END .and .loop asm_arguments_1;
1191 comma .and asm_argument .and .true .emit OP_END;
1194 <asm_argument> ::= <variable_identifier>
1197 note: this is an extension to the standard language specification - normally slang disallows
1202 variable_identifier .or
1206 variable_identifier .and dot .and field_selection .emit OP_FIELD;
1209 <translation_unit> ::= <external_declaration>
1210 | <translation_unit> <external_declaration>
1213 optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and
1214 .loop external_declaration .and optional_space .and
1215 '\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;
1218 <external_declaration> ::= <function_definition>
1221 external_declaration
1222 function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or
1223 declaration .emit EXTERNAL_DECLARATION;
1226 <function_definition> :: <function_prototype> <compound_statement_no_new_scope>
1229 function_prototype .and compound_statement_no_new_scope;
1231 /* helper rulez, not part of the official language syntax */
1240 '0'-'9' .or 'A'-'F' .or 'a'-'f';
1243 'a'-'z' .or 'A'-'Z' .or '_';
1246 id_character_first .or digit_dec;
1249 id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\0';
1252 float_1 .or float_2;
1254 float_fractional_constant .and float_optional_exponent_part;
1256 float_digit_sequence .and .true .emit '\0' .and float_exponent_part;
1258 float_fractional_constant
1259 float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;
1260 float_fractional_constant_1
1261 float_digit_sequence .and '.' .and float_digit_sequence;
1262 float_fractional_constant_2
1263 float_digit_sequence .and '.' .and .true .emit '\0';
1264 float_fractional_constant_3
1265 '.' .emit '\0' .and float_digit_sequence;
1267 float_optional_exponent_part
1268 float_exponent_part .or .true .emit '\0';
1270 float_digit_sequence
1271 digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
1274 float_exponent_part_1 .or float_exponent_part_2;
1275 float_exponent_part_1
1276 'e' .and float_optional_sign .and float_digit_sequence;
1277 float_exponent_part_2
1278 'E' .and float_optional_sign .and float_digit_sequence;
1281 float_sign .or .true;
1284 '+' .or '-' .emit '-';
1287 integer_hex .or integer_oct .or integer_dec;
1290 '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and
1296 '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\0';
1299 digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
1302 "true" .emit 2 .emit '1' .emit '\0' .or
1303 "false" .emit 2 .emit '0' .emit '\0';
1312 float .emit OP_PUSH_FLOAT;
1315 integer .emit OP_PUSH_INT;
1318 boolean .emit OP_PUSH_BOOL;
1324 single_space .and .loop single_space;
1327 white_char .or c_style_comment_block .or cpp_style_comment_block;
1330 ' ' .or '\t' .or new_line .or '\v' .or '\f';
1333 cr_lf .or lf_cr .or '\n' .or '\r';
1341 c_style_comment_block
1342 '/' .and '*' .and c_style_comment_rest;
1344 c_style_comment_rest
1345 .loop c_style_comment_char_no_star .and c_style_comment_rest_1;
1346 c_style_comment_rest_1
1347 c_style_comment_end .or c_style_comment_rest_2;
1348 c_style_comment_rest_2
1349 '*' .and c_style_comment_rest;
1351 c_style_comment_char_no_star
1352 '\x2B'-'\xFF' .or '\x01'-'\x29';
1357 cpp_style_comment_block
1358 '/' .and '/' .and cpp_style_comment_block_1;
1359 cpp_style_comment_block_1
1360 cpp_style_comment_block_2 .or cpp_style_comment_block_3;
1361 cpp_style_comment_block_2
1362 .loop cpp_style_comment_char .and new_line;
1363 cpp_style_comment_block_3
1364 .loop cpp_style_comment_char;
1366 cpp_style_comment_char
1367 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
1372 optional_space .and '&' .and optional_space;*/
1375 optional_space .and '&' .and '&' .and optional_space;
1378 optional_space .and '&' .and '=' .and optional_space;*/
1381 optional_space .and '|' .and optional_space;*/
1384 optional_space .and '|' .and '|' .and optional_space;
1387 optional_space .and '|' .and '=' .and optional_space;*/
1390 optional_space .and '!' .and optional_space;
1393 optional_space .and '!' .and '=' .and optional_space;
1396 optional_space .and '^' .and optional_space;*/
1399 optional_space .and '^' .and '^' .and optional_space;
1402 optional_space .and '^' .and '=' .and optional_space;*/
1405 optional_space .and ':' .and optional_space;
1408 optional_space .and ',' .and optional_space;
1411 optional_space .and '.' .and optional_space;
1414 optional_space .and '=' .and optional_space;
1417 optional_space .and '=' .and '=' .and optional_space;
1420 optional_space .and '>' .and optional_space;
1423 optional_space .and '>' .and '=' .and optional_space;
1426 optional_space .and '>' .and '>' .and optional_space;*/
1428 /*greatergreaterequals
1429 optional_space .and '>' .and '>' .and '=' .and optional_space;*/
1432 optional_space .and '{' .and optional_space;
1435 optional_space .and '[' .and optional_space;
1438 optional_space .and '<' .and optional_space;
1441 optional_space .and '<' .and '=' .and optional_space;
1444 optional_space .and '<' .and '<' .and optional_space;*/
1447 optional_space .and '<' .and '<' .and '=' .and optional_space;*/
1450 optional_space .and '(' .and optional_space;
1453 optional_space .and '-' .and optional_space;
1456 optional_space .and '-' .and '=' .and optional_space;
1459 optional_space .and '-' .and '-' .and optional_space;
1462 optional_space .and '%' .and optional_space;*/
1465 optional_space .and '%' .and '=' .and optional_space;*/
1468 optional_space .and '+' .and optional_space;
1471 optional_space .and '+' .and '=' .and optional_space;
1474 optional_space .and '+' .and '+' .and optional_space;
1477 optional_space .and '?' .and optional_space;
1480 optional_space .and '}' .and optional_space;
1483 optional_space .and ']' .and optional_space;
1486 optional_space .and ')' .and optional_space;
1489 optional_space .and ';' .and optional_space;
1492 optional_space .and '/' .and optional_space;
1495 optional_space .and '/' .and '=' .and optional_space;
1498 optional_space .and '*' .and optional_space;
1501 optional_space .and '*' .and '=' .and optional_space;
1504 optional_space .and '~' .and optional_space;*/
1506 /* string rulez - these are used internally by the parser when parsing quoted strings */
1508 .string string_lexer;
1511 lex_first_identifier_character .and .loop lex_next_identifier_character;
1513 lex_first_identifier_character
1514 'a'-'z' .or 'A'-'Z' .or '_';
1516 lex_next_identifier_character
1517 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
1519 /* error rulez - these are used by error messages */
1522 '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or
1523 '-' .or '+' .or '=' .or '|' .or '\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '"' .or
1524 '\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;
1527 id_character_first .and .loop id_character_next;