Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 57 lines (46 sloc) 1.514 kB
19f18d3 a new Symbol class, unicode-aware + refactored/cleaned symbol generation
Laurent Sansonetti authored
1 /*
2 * MacRuby Symbols.
3 *
4 * This file is covered by the Ruby license. See COPYING for more details.
5 *
9595725 update copyrights to 2011
Laurent Sansonetti authored
6 * Copyright (C) 2010-2011, Apple Inc. All rights reserved.
19f18d3 a new Symbol class, unicode-aware + refactored/cleaned symbol generation
Laurent Sansonetti authored
7 */
8
9 #ifndef __SYMBOL_H_
10 #define __SYMBOL_H_
11
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15
16 // For the parser.
17 #define ID_SCOPE_SHIFT 3
18 #define ID_SCOPE_MASK 0x07
19 #define ID_LOCAL 0x00
20 #define ID_INSTANCE 0x01
21 #define ID_GLOBAL 0x03
22 #define ID_ATTRSET 0x04
23 #define ID_CONST 0x05
24 #define ID_CLASS 0x06
25 #define ID_JUNK 0x07
26 #define ID_INTERNAL ID_JUNK
27
28 #define is_notop_id(id) (true)
29 #define is_local_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_LOCAL)
30 #define is_global_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_GLOBAL)
31 #define is_instance_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_INSTANCE)
32 #define is_attrset_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_ATTRSET)
33 #define is_const_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_CONST)
34 #define is_class_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_CLASS)
35 #define is_junk_id(id) (is_notop_id(id)&&((id)&ID_SCOPE_MASK)==ID_JUNK)
36
37 #define is_asgn_or_id(id) ((is_notop_id(id)) && \
38 (((id)&ID_SCOPE_MASK) == ID_GLOBAL || \
39 ((id)&ID_SCOPE_MASK) == ID_INSTANCE || \
40 ((id)&ID_SCOPE_MASK) == ID_CLASS))
41
42 struct rb_op_tbl_entry {
43 ID token;
44 const char *name;
45 };
46
47 // Defined in parse.y.
48 extern struct rb_op_tbl_entry rb_op_tbl[];
49
f738483 honor the original string encoding when generating substrings out of …
Laurent Sansonetti authored
50 VALUE rb_sym_str(VALUE sym);
51
19f18d3 a new Symbol class, unicode-aware + refactored/cleaned symbol generation
Laurent Sansonetti authored
52 #if defined(__cplusplus)
53 } // extern "C"
54 #endif
55
56 #endif // __SYMBOL_H_
Something went wrong with that request. Please try again.