forked from pmougin/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFSCompiler.h
46 lines (36 loc) · 1.7 KB
/
FSCompiler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* FSCompiler.h Copyright (c) 1998-2009 Philippe Mougin. */
/* This software is open source. See the license. */
#import <Foundation/Foundation.h>
#import "FSCompilationResult.h"
@class FSSymbolTable, FSMethod;
enum e_token_type { KW_FALSE, KW_TRUE, KW_NIL, KW_SUPER, OPEN_BRACKET, CLOSE_BRACKET, NAME, END, SNUMBER, SDATE, OPEN_PARENTHESE
, CLOSE_PARENTHESE, COMMA, SEMICOLON, PERIOD, SSTRING, OPEN_BRACE, CLOSE_BRACE, OPERATOR, COLON
, SASSIGNMENT, AT, COMPACT_BLOCK, PREDEFINED_OBJECT, CARET, DICTIONARY_BEGIN};
struct res_scan
{
enum e_token_type type;
NSMutableString *value;
};
@interface FSCompiler:NSObject
{
struct res_scan rs; // current result of the lexical parsing (scanning)
__strong const char *string; // string to compile
int32_t string_index; // in order to scan the string to compile
int32_t token_first_char_index; // index in the string of the first character of the current token
int32_t string_size; // size of the string to compile
jmp_buf error_handler;
NSString *errorStr;
NSInteger errorFirstCharIndex;
NSInteger errorLastCharIndex;
}
+ (id)compiler;
+ (FSMethod *)dummyDeallocMethodForClassNamed:(NSString *)className;
+ (BOOL)isValidIdentifier:(NSString *)str;
+ (NSString *)stringFromSelector:(SEL)selector;
+ (SEL)selectorFromString:(NSString *)selectorStr;
- (void) dealloc;
- (id)init;
- (FSCompilationResult *) compileCode:(const char *)utf8str withParentSymbolTable:(FSSymbolTable *)symbol_table;
- (FSCompilationResult *) compileCodeForBlock:(const char *)utf8str withParentSymbolTable:(FSSymbolTable *)symbol_table;
//- (CompilationResult *) compileCodeForMethod:(const char *)utf8strs;
@end