Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / mesa / shader / slang / library / slang_pp_version.syn
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.6
4 *
5 * Copyright (C) 2005-2006 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 slang_pp_version.syn
27 * slang #version directive syntax
28 * \author Michal Krol
29 */
30
31 .syntax version_directive;
32
33 version_directive
34 version_directive_1;
35 version_directive_1
36 prior_optional_spaces .and optional_version_directive .and .true .emit $;
37
38 optional_version_directive
39 version_directive_body .or .true .emit 10 .emit 1;
40
41 version_directive_body
42 '#' .and optional_space .and "version" .and space .and version_number .and optional_space .and
43 new_line;
44
45 version_number
46 version_number_100 .or version_number_110 .or version_number_120;
47
48 version_number_100
49 leading_zeroes .and "100" .emit 0 .emit 1;
50
51 version_number_110
52 leading_zeroes .and "110" .emit 10 .emit 1;
53
54 version_number_120
55 leading_zeroes .and "120" .emit 20 .emit 1;
56
57 leading_zeroes
58 .loop zero;
59
60 zero
61 '0';
62
63 space
64 single_space .and .loop single_space;
65
66 optional_space
67 .loop single_space;
68
69 single_space
70 ' ' .or '\t';
71
72 prior_optional_spaces
73 .loop prior_space;
74
75 prior_space
76 c_style_comment_block .or cpp_style_comment_block .or space .or new_line;
77
78 c_style_comment_block
79 '/' .and '*' .and c_style_comment_rest;
80
81 c_style_comment_rest
82 .loop c_style_comment_char_no_star .and c_style_comment_rest_1;
83 c_style_comment_rest_1
84 c_style_comment_end .or c_style_comment_rest_2;
85 c_style_comment_rest_2
86 '*' .and c_style_comment_rest;
87
88 c_style_comment_char_no_star
89 '\x2B'-'\xFF' .or '\x01'-'\x29';
90
91 c_style_comment_end
92 '*' .and '/';
93
94 cpp_style_comment_block
95 '/' .and '/' .and cpp_style_comment_block_1;
96 cpp_style_comment_block_1
97 cpp_style_comment_block_2 .or cpp_style_comment_block_3;
98 cpp_style_comment_block_2
99 .loop cpp_style_comment_char .and new_line;
100 cpp_style_comment_block_3
101 .loop cpp_style_comment_char;
102
103 cpp_style_comment_char
104 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
105
106 new_line
107 cr_lf .or lf_cr .or '\n' .or '\r';
108
109 cr_lf
110 '\r' .and '\n';
111
112 lf_cr
113 '\n' .and '\r';
114
115 .string __string_filter;
116
117 __string_filter
118 .loop __identifier_char;
119
120 __identifier_char
121 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';
122