Add some missing files to repo. Refined interface to compiler.
[panda.git] / goo / st-lexer.h
blob8925bc95195e7832ddc6b94b364f7e6284debefc
1 /*
2 * st-lexer.h
4 * Copyright (C) 2008 Vincent Geddes
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
25 #ifndef __ST_LEXER_H__
26 #define __ST_LEXER_H__
28 #include <glib.h>
29 #include <stdbool.h>
31 typedef struct STLexer STLexer;
32 typedef struct STToken STToken;
34 typedef enum
36 ST_TOKEN_INVALID,
37 ST_TOKEN_LPAREN,
38 ST_TOKEN_RPAREN,
39 ST_TOKEN_BLOCK_BEGIN,
40 ST_TOKEN_BLOCK_END,
41 ST_TOKEN_COMMA,
42 ST_TOKEN_SEMICOLON,
43 ST_TOKEN_PERIOD,
44 ST_TOKEN_RETURN,
45 ST_TOKEN_COLON,
46 ST_TOKEN_ASSIGN,
47 ST_TOKEN_TUPLE_BEGIN,
48 ST_TOKEN_IDENTIFIER,
49 ST_TOKEN_CHARACTER_CONST,
50 ST_TOKEN_STRING_CONST,
51 ST_TOKEN_NUMBER_CONST,
52 ST_TOKEN_SYMBOL_CONST,
53 ST_TOKEN_COMMENT,
54 ST_TOKEN_BINARY_SELECTOR,
55 ST_TOKEN_KEYWORD_SELECTOR,
56 ST_TOKEN_EOF
58 } STTokenType;
61 STLexer *st_lexer_new (const char *text);
63 STToken *st_lexer_next_token (STLexer *lexer);
65 STToken *st_lexer_current_token (STLexer *lexer);
67 void st_lexer_destroy (STLexer *lexer);
69 gunichar st_lexer_error_char (STLexer *lexer);
71 guint st_lexer_error_line (STLexer *lexer);
73 guint st_lexer_error_column (STLexer *lexer);
75 char *st_lexer_error_message (STLexer *lexer);
77 void st_lexer_filter_comments (STLexer *lexer, bool filter);
80 STTokenType st_token_type (STToken *token);
82 char *st_token_text (STToken *token);
84 guint st_token_line (STToken *token);
86 guint st_token_column (STToken *token);
89 char *st_number_token_number (STToken *token);
91 guint st_number_token_radix (STToken *token);
93 int st_number_token_exponent (STToken *token);
97 #endif /* __ST_LEXER_H__ */