2 Copyright (C) 2003 by Walter Schreppers
3 Copyright (C) 2004 by Cies Breijs
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of version 2 of the GNU General Public
7 License as published by the Free Software Foundation.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 struct Pos
// convenience, it codes a bit nicer with this, i.e.: "int row = tok.start.row"
36 int type
; // filled with enumed tokenTypes
37 QString look
; // the way the token looks in the text editor
38 Value value
; // if the token is a number it can be stored here
39 Pos start
; // row'n'col of the starting/ending point of the token
46 tokNotSet
= 0, // inittial type of all tokens
47 tokError
= 1, // when there is an error
48 tokUnknown
= 2, // when no token was found, a tokUnknown is often a variable, function or error
50 tokIf
, // the execution controlling tokens
61 tokBegin
, // the scope delimiting tokens
64 tokNumber
, // the containers
67 tokAssign
, // for assignments
69 tokAnd
, // and, or, not
73 tokEq
, // ==, !=, >=, >, <=, <
80 tokBraceOpen
, // (, ), +, -, *, /
89 tokEOL
, // End Of Line token
90 tokEOF
, // End Of File token
92 tokLearn
, // learn command
94 tokClear
, // the 'regular' command tokens
127 tokDo
// a dummy command
130 // const QString tokenTypeNames[] =
132 // /* tokNotSet = 0 */ "",
133 // /* tokError = 1 */ "",
134 // /* tokUnknown = 2 */ "name",
137 // /* tokElse */ "else",
138 // /* tokWhile */ "while",
139 // /* tokFor */ "for",
141 // /* tokStep */ "step",
142 // /* tokForEach */ "each",
144 // /* tokBreak */ "break",
145 // /* tokReturn */ "return",
147 // /* tokBegin */ "",
150 // /* tokNumber */ "number",
151 // /* tokString */ "string",
153 // /* tokAssign */ "asignment",
155 // /* tokAnd */ "and",
157 // /* tokNot */ "not",
159 // /* tokEq */ "questions",
160 // /* tokNe */ "questions",
161 // /* tokGe */ "questions",
162 // /* tokGt */ "questions",
163 // /* tokLe */ "questions",
164 // /* tokLt */ "questions",
166 // /* tokBraceOpen */ "math",
167 // /* tokBraceClose */ "math",
168 // /* tokPlus */ "math",
169 // /* tokMinus */ "math",
170 // /* tokMul */ "math",
171 // /* tokDev */ "math",
173 // /* tokComma */ "",
178 // /* tokLearn */ "learn",
180 // /* tokClear */ "clear",
182 // /* tokGoX */ "gox",
183 // /* tokGoY */ "goy",
184 // /* tokForward */ "forward",
185 // /* tokBackward */ "backward",
186 // /* tokDirection */ "direction",
187 // /* tokTurnLeft */ "turnleft",
188 // /* tokTurnRight */ "turnright",
189 // /* tokCenter */ "center",
190 // /* tokSetPenWidth */ "setpenwidth",
191 // /* tokPenUp */ "penup",
192 // /* tokPenDown */ "pendown",
193 // /* tokSetFgColor */ "setfgcolor",
194 // /* tokSetBgColor */ "setbgcolor",
195 // /* tokResizeCanvas */ "resizecanvas",
196 // /* tokSpriteShow */ "spriteshow",
197 // /* tokSpriteHide */ "spritehide",
198 // /* tokSpritePress */ "",
199 // /* tokSpriteChange */ "",
200 // /* tokMessage */ "message",
201 // /* tokInputWindow */ "inputwindow",
202 // /* tokPrint */ "print",
203 // /* tokFontType */ "",
204 // /* tokFontSize */ "fontsize",
205 // /* tokRepeat */ "repeat",
206 // /* tokRandom */ "random",
207 // /* tokWait */ "wait",
208 // /* tokWrapOn */ "wrapon",
209 // /* tokWrapOff */ "wrapoff",
210 // /* tokReset */ "reset",
211 // /* tokRun */ "run",
216 // // QString Token::tokenType2name(int tokenType)
218 // // if (tokenType >= 0) return tokenTypeNames[tokenType];
219 // // else return "";