Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
e0220803
Unverified
Commit
e0220803
authored
Oct 29, 2018
by
take-cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define null symbol
parent
3248de83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
include/mruby/symbol.h
include/mruby/symbol.h
+1
-0
src/symbol.c
src/symbol.c
+2
-2
No files found.
include/mruby/symbol.h
View file @
e0220803
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
MRB_BEGIN_DECL
MRB_BEGIN_DECL
typedef
enum
mrb_reserved_symbol
{
typedef
enum
mrb_reserved_symbol
{
mrb_sym_null
=
0
,
// NULL symbol
mrb_sym_add
=
1
,
// +
mrb_sym_add
=
1
,
// +
mrb_sym_sub
=
2
,
// -
mrb_sym_sub
=
2
,
// -
mrb_sym_mul
=
3
,
// *
mrb_sym_mul
=
3
,
// *
...
...
src/symbol.c
View file @
e0220803
...
@@ -187,7 +187,7 @@ static struct reserved_symbol_t reserved_symbols[] = {
...
@@ -187,7 +187,7 @@ static struct reserved_symbol_t reserved_symbols[] = {
{
mrb_sym_gt
,
">"
},
{
mrb_sym_gt
,
">"
},
{
mrb_sym_ge
,
">="
},
{
mrb_sym_ge
,
">="
},
{
mrb_sym_method_missing
,
"method_missing"
},
{
mrb_sym_method_missing
,
"method_missing"
},
{
0
,
NULL
},
{
mrb_sym_null
,
NULL
},
};
};
void
void
...
@@ -196,7 +196,7 @@ mrb_init_symtbl(mrb_state *mrb)
...
@@ -196,7 +196,7 @@ mrb_init_symtbl(mrb_state *mrb)
int
i
;
int
i
;
mrb
->
name2sym
=
kh_init
(
n2s
,
mrb
);
mrb
->
name2sym
=
kh_init
(
n2s
,
mrb
);
for
(
i
=
0
;
reserved_symbols
[
i
].
sym
!=
0
;
++
i
)
{
for
(
i
=
0
;
reserved_symbols
[
i
].
sym
!=
mrb_sym_null
;
++
i
)
{
mrb_sym
s
=
mrb_intern_static
(
mrb
,
reserved_symbols
[
i
].
str
,
strlen
(
reserved_symbols
[
i
].
str
));
mrb_sym
s
=
mrb_intern_static
(
mrb
,
reserved_symbols
[
i
].
str
,
strlen
(
reserved_symbols
[
i
].
str
));
mrb_assert
(
s
==
reserved_symbols
[
i
].
sym
);
mrb_assert
(
s
==
reserved_symbols
[
i
].
sym
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment