Merge commit 'origin/master' into drm-gem
[mesa.git] / src / mesa / shader / slang / library / slang_pp_directives.syn
index 5cbd15fd33d6072d41fc4d33748f0dabdb896bea..d4a321034d1693b8e16725b5ba266415c71c86ef 100755 (executable)
-/*\r
- * Mesa 3-D graphics library\r
- * Version:  6.6\r
- *\r
- * Copyright (C) 2006  Brian Paul   All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-/**\r
- * \file slang_pp_directives.syn\r
- * slang preprocessor directives parser\r
- * \author Michal Krol\r
- */\r
-\r
-.syntax source;\r
-\r
-/*\r
- * This syntax script preprocesses a GLSL shader.\r
- * It is assumed, that the #version directive has been parsed. Separate pass for parsing\r
- * version gives better control on behavior depending on the version number given.\r
- *\r
- * The output is a source string with comments and directives removed. White spaces and comments\r
- * are replaced with on or more spaces. All new-lines are preserved and converted to Linux format.\r
- * Directives are escaped with a null character. The end of the source string is marked by\r
- * two consecutive null characters. The consumer is responsible for executing the escaped\r
- * directives, removing dead portions of code and expanding macros.\r
- */\r
-\r
-.emtcode ESCAPE_TOKEN 0\r
-\r
-/*\r
- * The TOKEN_* symbols follow the ESCAPE_TOKEN.\r
- *\r
- * NOTE:\r
- * There is no TOKEN_IFDEF and neither is TOKEN_IFNDEF. They are handled with TOKEN_IF and\r
- * operator defined.\r
- * The "#ifdef SYMBOL" is replaced with "#if defined SYMBOL"\r
- * The "#ifndef SYMBOL" is replaced with "#if !defined SYMBOL"\r
- */\r
-.emtcode TOKEN_END       0\r
-.emtcode TOKEN_DEFINE    1\r
-.emtcode TOKEN_UNDEF     2\r
-.emtcode TOKEN_IF        3\r
-.emtcode TOKEN_ELSE      4\r
-.emtcode TOKEN_ELIF      5\r
-.emtcode TOKEN_ENDIF     6\r
-.emtcode TOKEN_ERROR     7\r
-.emtcode TOKEN_PRAGMA    8\r
-.emtcode TOKEN_EXTENSION 9\r
-.emtcode TOKEN_LINE      10\r
-\r
-/*\r
- * The PARAM_* symbols follow the TOKEN_DEFINE.\r
- */\r
-.emtcode PARAM_END       0\r
-.emtcode PARAM_PARAMETER 1\r
-\r
-/*\r
- * The BEHAVIOR_* symbols follow the TOKEN_EXTENSION.\r
- */\r
-.emtcode BEHAVIOR_REQUIRE 1\r
-.emtcode BEHAVIOR_ENABLE  2\r
-.emtcode BEHAVIOR_WARN    3\r
-.emtcode BEHAVIOR_DISABLE 4\r
-\r
-source\r
-   optional_directive .and .loop source_element .and '\0' .emit ESCAPE_TOKEN .emit TOKEN_END;\r
-\r
-source_element\r
-   c_style_comment_block .or cpp_style_comment_block .or new_line_directive .or source_token;\r
-\r
-c_style_comment_block\r
-   '/' .and '*' .and c_style_comment_rest .and .true .emit ' ';\r
-\r
-c_style_comment_rest\r
-   .loop c_style_comment_body .and c_style_comment_end;\r
-\r
-c_style_comment_body\r
-   c_style_comment_char_nostar .or c_style_comment_char_star_noslashstar;\r
-\r
-c_style_comment_char_nostar\r
-   new_line .or '\x2B'-'\xFF' .or '\x01'-'\x29';\r
-\r
-c_style_comment_char_star_noslashstar\r
-   '*' .and c_style_comment_char_star_noslashstar_1;\r
-c_style_comment_char_star_noslashstar_1\r
-   c_style_comment_char_noslashstar .or c_style_comment_char_star_noslashstar;\r
-\r
-c_style_comment_char_noslashstar\r
-   new_line .or '\x30'-'\xFF' .or '\x01'-'\x29' .or '\x2B'-'\x2E';\r
-\r
-c_style_comment_end\r
-   '*' .and .loop c_style_comment_char_star .and '/';\r
-\r
-c_style_comment_char_star\r
-   '*';\r
-\r
-cpp_style_comment_block\r
-   '/' .and '/' .and cpp_style_comment_block_1;\r
-cpp_style_comment_block_1\r
-   cpp_style_comment_block_2 .or cpp_style_comment_block_3;\r
-cpp_style_comment_block_2\r
-   .loop cpp_style_comment_char .and new_line_directive;\r
-cpp_style_comment_block_3\r
-   .loop cpp_style_comment_char;\r
-\r
-cpp_style_comment_char\r
-   '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';\r
-\r
-new_line_directive\r
-   new_line .and optional_directive;\r
-\r
-new_line\r
-   generic_new_line .emit '\n';\r
-\r
-generic_new_line\r
-   carriage_return_line_feed .or line_feed_carriage_return .or '\n' .or '\r';\r
-\r
-carriage_return_line_feed\r
-   '\r' .and '\n';\r
-\r
-line_feed_carriage_return\r
-   '\n' .and '\r';\r
-\r
-optional_directive\r
-   directive .emit ESCAPE_TOKEN .or .true;\r
-\r
-directive\r
-   dir_define .emit TOKEN_DEFINE .or\r
-   dir_undef .emit TOKEN_UNDEF .or\r
-   dir_if .emit TOKEN_IF .or\r
-   dir_ifdef .emit TOKEN_IF .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e' .emit 'd'\r
-             .emit ' ' .or\r
-   dir_ifndef .emit TOKEN_IF .emit '!' .emit 'd' .emit 'e' .emit 'f' .emit 'i' .emit 'n' .emit 'e'\r
-              .emit 'd' .emit ' ' .or\r
-   dir_else .emit TOKEN_ELSE .or\r
-   dir_elif .emit TOKEN_ELIF .or\r
-   dir_endif .emit TOKEN_ENDIF .or\r
-   dir_ext .emit TOKEN_EXTENSION .or\r
-   dir_line .emit TOKEN_LINE;\r
-\r
-dir_define\r
-   optional_space .and '#' .and optional_space .and "define" .and symbol .and opt_parameters .and\r
-   definition;\r
-\r
-dir_undef\r
-   optional_space .and '#' .and optional_space .and "undef" .and symbol;\r
-\r
-dir_if\r
-   optional_space .and '#' .and optional_space .and "if" .and expression;\r
-\r
-dir_ifdef\r
-   optional_space .and '#' .and optional_space .and "ifdef" .and symbol;\r
-\r
-dir_ifndef\r
-   optional_space .and '#' .and optional_space .and "ifndef" .and symbol;\r
-\r
-dir_else\r
-   optional_space .and '#' .and optional_space .and "else";\r
-\r
-dir_elif\r
-   optional_space .and '#' .and optional_space .and "elif" .and expression;\r
-\r
-dir_endif\r
-   optional_space .and '#' .and optional_space .and "endif";\r
-\r
-dir_ext\r
-   optional_space .and '#' .and optional_space .and "extension" .and space .and extension_name .and\r
-   optional_space .and ':' .and optional_space .and extension_behavior;\r
-\r
-dir_line\r
-   optional_space .and '#' .and optional_space .and "line" .and expression;\r
-\r
-symbol\r
-   space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';\r
-\r
-opt_parameters\r
-   parameters .or .true .emit PARAM_END;\r
-\r
-parameters\r
-   '(' .and parameters_1 .and optional_space .and ')' .emit PARAM_END;\r
-parameters_1\r
-   parameters_2 .or .true;\r
-parameters_2\r
-   parameter .emit PARAM_PARAMETER .and .loop parameters_3;\r
-parameters_3\r
-   optional_space .and ',' .and parameter .emit PARAM_PARAMETER;\r
-\r
-parameter\r
-   optional_space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and\r
-   .true .emit '\0';\r
-\r
-definition\r
-   .loop definition_character .emit * .and .true .emit '\0';\r
-\r
-definition_character\r
-   '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';\r
-\r
-expression\r
-   expression_element .and .loop expression_element .and .true .emit '\0';\r
-\r
-expression_element\r
-   expression_character .emit *;\r
-\r
-expression_character\r
-   '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';\r
-\r
-extension_name\r
-   symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';\r
-\r
-extension_behavior\r
-   "require" .emit BEHAVIOR_REQUIRE .or\r
-   "enable" .emit BEHAVIOR_ENABLE .or\r
-   "warn" .emit BEHAVIOR_WARN .or\r
-   "disable" .emit BEHAVIOR_DISABLE;\r
-\r
-optional_space\r
-   .loop single_space;\r
-\r
-space\r
-   single_space .and .loop single_space;\r
-\r
-single_space\r
-   ' ' .or '\t';\r
-\r
-source_token\r
-   space .emit ' ' .or complex_token .or source_token_1;\r
-source_token_1\r
-   simple_token .emit ' ' .and .true .emit ' ';\r
-\r
-/*\r
- * All possible tokens.\r
- */\r
-\r
-complex_token\r
-   identifier .or number;\r
-\r
-simple_token\r
-   increment .or decrement .or lequal .or gequal .or equal .or nequal .or and .or xor .or or .or\r
-   addto .or subtractfrom .or multiplyto .or divideto .or other;\r
-\r
-identifier\r
-   identifier_char1 .emit * .and .loop identifier_char2 .emit *;\r
-identifier_char1\r
-   'a'-'z' .or 'A'-'Z' .or '_';\r
-identifier_char2\r
-   'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\r
-\r
-number\r
-   float .or integer;\r
-\r
-digit_oct\r
-   '0'-'7';\r
-\r
-digit_dec\r
-   '0'-'9';\r
-\r
-digit_hex\r
-   '0'-'9' .or 'A'-'F' .or 'a'-'f';\r
-\r
-float\r
-   float_1 .or float_2;\r
-float_1\r
-   float_fractional_constant .and float_optional_exponent_part;\r
-float_2\r
-   float_digit_sequence .and float_exponent_part;\r
-\r
-float_fractional_constant\r
-   float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\r
-float_fractional_constant_1\r
-   float_digit_sequence .and '.' .emit '.' .and float_digit_sequence;\r
-float_fractional_constant_2\r
-   float_digit_sequence .and '.' .emit '.';\r
-float_fractional_constant_3\r
-   '.' .emit '.' .and float_digit_sequence;\r
-\r
-float_optional_exponent_part\r
-   float_exponent_part .or .true;\r
-\r
-float_digit_sequence\r
-   digit_dec .emit * .and .loop digit_dec .emit *;\r
-\r
-float_exponent_part\r
-   float_exponent_part_1 .or float_exponent_part_2;\r
-float_exponent_part_1\r
-   'e' .emit 'e' .and float_optional_sign .and float_digit_sequence;\r
-float_exponent_part_2\r
-   'E' .emit 'E' .and float_optional_sign .and float_digit_sequence;\r
-\r
-float_optional_sign\r
-   '+' .emit '+' .or '-' .emit '-' .or .true;\r
-\r
-integer\r
-   integer_hex .or integer_oct .or integer_dec;\r
-\r
-integer_hex\r
-   '0' .emit '0' .and integer_hex_1 .emit * .and digit_hex .emit * .and\r
-   .loop digit_hex .emit *;\r
-integer_hex_1\r
-   'x' .or 'X';\r
-\r
-integer_oct\r
-   '0' .emit '0' .and .loop digit_oct .emit *;\r
-\r
-integer_dec\r
-   digit_dec .emit * .and .loop digit_dec .emit *;\r
-\r
-increment\r
-   '+' .emit * .and '+' .emit *;\r
-\r
-decrement\r
-   '-' .emit * .and '-' .emit *;\r
-\r
-lequal\r
-   '<' .emit * .and '=' .emit *;\r
-\r
-gequal\r
-   '>' .emit * .and '=' .emit *;\r
-\r
-equal\r
-   '=' .emit * .and '=' .emit *;\r
-\r
-nequal\r
-   '!' .emit * .and '=' .emit *;\r
-\r
-and\r
-   '&' .emit * .and '&' .emit *;\r
-\r
-xor\r
-   '^' .emit * .and '^' .emit *;\r
-\r
-or\r
-   '|' .emit * .and '|' .emit *;\r
-\r
-addto\r
-   '+' .emit * .and '=' .emit *;\r
-\r
-subtractfrom\r
-   '-' .emit * .and '=' .emit *;\r
-\r
-multiplyto\r
-   '*' .emit * .and '=' .emit *;\r
-\r
-divideto\r
-   '/' .emit * .and '=' .emit *;\r
-\r
-/*\r
- * All characters except '\0' and '#'.\r
- */\r
-other\r
-   '\x24'-'\xFF' .emit * .or '\x01'-'\x22' .emit *;\r
-\r
-symbol_character\r
-   'A'-'Z' .or 'a'-'z' .or '_';\r
-\r
-symbol_character2\r
-   'A'-'Z' .or 'a'-'z' .or '0'-'9' .or '_';\r
-\r
-.string string_lexer;\r
-\r
-string_lexer\r
-   lex_first_identifier_character .and .loop lex_next_identifier_character;\r
-\r
-lex_first_identifier_character\r
-   'a'-'z' .or 'A'-'Z' .or '_';\r
-\r
-lex_next_identifier_character\r
-   'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\r
-\r
+/*
+ * 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 '_';
+