1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2013 Academy of Motion Picture Arts and Sciences
3 // ("A.M.P.A.S."). Portions contributed by others as indicated.
4 // All rights reserved.
5 //
6 // A worldwide, royalty-free, non-exclusive right to copy, modify, create
7 // derivatives, and use, in source and binary forms, is hereby granted,
8 // subject to acceptance of this license. Performance of any of the
9 // aforementioned acts indicates acceptance to be bound by the following
10 // terms and conditions:
11 //
12 //  * Copies of source code, in whole or in part, must retain the
13 //    above copyright notice, this list of conditions and the
14 //    Disclaimer of Warranty.
15 //
16 //  * Use in binary form must retain the above copyright notice,
17 //    this list of conditions and the Disclaimer of Warranty in the
18 //    documentation and/or other materials provided with the distribution.
19 //
20 //  * Nothing in this license shall be deemed to grant any rights to
21 //    trademarks, copyrights, patents, trade secrets or any other
22 //    intellectual property of A.M.P.A.S. or any contributors, except
23 //    as expressly stated herein.
24 //
25 //  * Neither the name "A.M.P.A.S." nor the name of any other
26 //    contributors to this software may be used to endorse or promote
27 //    products derivative of or based on this software without express
28 //    prior written permission of A.M.P.A.S. or the contributors, as
29 //    appropriate.
30 //
31 // This license shall be construed pursuant to the laws of the State of
32 // California, and any disputes related thereto shall be subject to the
33 // jurisdiction of the courts therein.
34 //
35 // Disclaimer of Warranty: THIS SOFTWARE IS PROVIDED BY A.M.P.A.S. AND
36 // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
37 // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
38 // FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO
39 // EVENT SHALL A.M.P.A.S., OR ANY CONTRIBUTORS OR DISTRIBUTORS, BE LIABLE
40 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, RESITUTIONARY,
41 // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
46 // THE POSSIBILITY OF SUCH DAMAGE.
47 //
48 // WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE ACADEMY
49 // SPECIFICALLY DISCLAIMS ANY REPRESENTATIONS OR WARRANTIES WHATSOEVER
50 // RELATED TO PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS IN THE ACADEMY
51 // COLOR ENCODING SYSTEM, OR APPLICATIONS THEREOF, HELD BY PARTIES OTHER
52 // THAN A.M.P.A.S., WHETHER DISCLOSED OR UNDISCLOSED.
53 ///////////////////////////////////////////////////////////////////////////
54 
55 
56 #ifndef INCLUDED_CTL_TOKENS_H
57 #define INCLUDED_CTL_TOKENS_H
58 
59 //-----------------------------------------------------------------------------
60 //
61 //	Syntactic tokens for the color transformation language.
62 //
63 //-----------------------------------------------------------------------------
64 
65 namespace Ctl {
66 
67 enum Token
68 {
69     TK_AND,		// "&&"
70     TK_ASSIGN,		// "="
71     TK_AT,              // "@error##" where ## is an integer
72     TK_BITAND,		// "&"
73     TK_BITNOT,		// "~"
74     TK_BITOR,		// "|"
75     TK_BITXOR,		// "^"
76     TK_BOOL,		// "bool"
77     TK_BREAK,		// "break"
78     TK_CLOSEBRACE,	// "}"
79     TK_CLOSEBRACKET,	// "]"
80     TK_CLOSEPAREN,	// ")"
81     TK_COMMA,		// ","
82     TK_CONST,		// "const"
83     TK_CONTINUE,	// "continue"
84     TK_CTLVERSION,	// "ctlversion"
85     TK_DIV,		// "/"
86     TK_DOT,             // "." not followed by digits
87     TK_ELSE,		// "else"
88     TK_END,		// end of input
89     TK_EQUAL,		// "=="
90     TK_FALSE,		// "false"
91     TK_FLOAT,		// "float"
92     TK_FLOATLITERAL,	// 32-bit floating point literal, e.g. "123.45"
93     TK_FOR,		// "for"
94     TK_GREATER,		// ">"
95     TK_GREATEREQUAL,	// ">="
96     TK_HALF,		// "half"
97     TK_HALFLITERAL,	// 16-bit floating-point literal, e.g. "123.4h"
98     TK_IF,		// "if"
99     TK_IMPORT,		// "import"
100     TK_INPUT,		// "input"
101     TK_INT,		// "int"
102     TK_INTLITERAL,	// integer literal, e.g. "123"
103     TK_LEFTSHIFT,	// "<<"
104     TK_LESS,		// "<"
105     TK_LESSEQUAL,	// "<="
106     TK_MINUS,		// "-"
107     TK_MOD,		// "%"
108     TK_NAME,		// name, e.g. "x"
109     TK_NAMESPACE,	// "namespace"
110     TK_NOT,		// "!"
111     TK_NOTEQUAL,	// "!="
112     TK_OPENBRACE,	// "{"
113     TK_OPENBRACKET,	// "["
114     TK_OPENPAREN,	// "("
115     TK_OR,		// "||"
116     TK_OUTPUT,		// "output"
117     TK_PLUS,		// "+"
118     TK_PRINT,		// "print"
119     TK_RETURN,		// "return"
120     TK_RIGHTSHIFT,	// ">>"
121     TK_SCOPE,		// "::"
122     TK_SEMICOLON,	// ";"
123     TK_STRINGLITERAL,	// string literal
124     TK_STRING,		// "string"
125     TK_STRUCT,		// "struct"
126     TK_TIMES,		// "*"
127     TK_TRUE,		// "true"
128     TK_UNDEFINED,	// undefined token / undefined value
129     TK_UNIFORM,		// "uniform"
130     TK_UNSIGNED,	// "unigned"
131     TK_VARYING,		// "varying"
132     TK_VOID,		// "void"
133     TK_WHILE,		// "while"
134 };
135 
136 
137 const char *		tokenAsString (Token token);
138 
139 
140 } // namespace Ctl
141 
142 #endif
143