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
25 #ifndef __ST_LEXER_H__
26 #define __ST_LEXER_H__
31 typedef struct STLexer STLexer
;
32 typedef struct STToken STToken
;
49 ST_TOKEN_CHARACTER_CONST
,
50 ST_TOKEN_STRING_CONST
,
51 ST_TOKEN_NUMBER_CONST
,
52 ST_TOKEN_SYMBOL_CONST
,
54 ST_TOKEN_BINARY_SELECTOR
,
55 ST_TOKEN_KEYWORD_SELECTOR
,
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__ */