c_lexer 2.5.1.2.0 → 2.5.3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/appveyor.yml +1 -0
- data/c_lexer.gemspec +1 -1
- data/ext/lexer/emit_tables.h +5 -5
- data/ext/lexer/lexer.c +3654 -3647
- data/ext/lexer/lexer.h +29 -29
- data/ext/lexer/lexer.rl +508 -508
- data/ext/lexer/{literal.h → literal/literal.h} +2 -2
- data/ext/lexer/literal/methods.h +1 -1
- data/ext/lexer/stack_state/cmdarg.h +47 -0
- data/ext/lexer/stack_state/cond.h +47 -0
- data/ext/lexer/{stack.h → stack_state/stack.h} +0 -0
- data/ext/lexer/{stack_state.h → stack_state/stack_state.h} +2 -2
- data/lib/c_lexer/version.rb +1 -1
- metadata +9 -9
- data/ext/lexer/cmdarg.h +0 -47
- data/ext/lexer/cond.h +0 -47
@@ -6,7 +6,7 @@ typedef struct literal literal;
|
|
6
6
|
#include "lexer.h"
|
7
7
|
|
8
8
|
struct literal {
|
9
|
-
struct
|
9
|
+
struct Lexer *lexer;
|
10
10
|
VALUE buffer;
|
11
11
|
long buffer_s;
|
12
12
|
long buffer_e;
|
@@ -35,7 +35,7 @@ struct literal {
|
|
35
35
|
int dedent_level;
|
36
36
|
};
|
37
37
|
|
38
|
-
static void literal_init(literal*,
|
38
|
+
static void literal_init(literal*, Lexer*, VALUE, VALUE, long, long, int, int, int);
|
39
39
|
static str_type literal_string_to_str_type(VALUE);
|
40
40
|
static VALUE literal_str_type_to_string(str_type);
|
41
41
|
static void literal_set_start_tok_and_interpolate(literal*, str_type);
|
data/ext/lexer/literal/methods.h
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
static VALUE lexer_push_cmdarg_state(VALUE self, VALUE bit)
|
2
|
+
{
|
3
|
+
Lexer* lexer = GET_LEXER(self);
|
4
|
+
int bitval = RTEST(bit) ? 1 : 0;
|
5
|
+
stack_state_push(&lexer->cmdarg, bitval);
|
6
|
+
return Qnil;
|
7
|
+
}
|
8
|
+
|
9
|
+
static VALUE lexer_pop_cmdarg_state(VALUE self)
|
10
|
+
{
|
11
|
+
Lexer* lexer = GET_LEXER(self);
|
12
|
+
stack_state_pop(&lexer->cmdarg);
|
13
|
+
return Qnil;
|
14
|
+
}
|
15
|
+
|
16
|
+
static VALUE lexer_lexpop_cmdarg_state(VALUE self)
|
17
|
+
{
|
18
|
+
Lexer* lexer = GET_LEXER(self);
|
19
|
+
stack_state_lexpop(&lexer->cmdarg);
|
20
|
+
return Qnil;
|
21
|
+
}
|
22
|
+
|
23
|
+
static VALUE lexer_clear_cmdarg_state(VALUE self)
|
24
|
+
{
|
25
|
+
Lexer* lexer = GET_LEXER(self);
|
26
|
+
stack_state_clear(&lexer->cmdarg);
|
27
|
+
return Qnil;
|
28
|
+
}
|
29
|
+
|
30
|
+
static VALUE lexer_cmdarg_state_empty_p(VALUE self)
|
31
|
+
{
|
32
|
+
Lexer* lexer = GET_LEXER(self);
|
33
|
+
return stack_state_empty_p(&lexer->cmdarg) ? Qtrue : Qfalse;
|
34
|
+
}
|
35
|
+
|
36
|
+
static VALUE lexer_cmdarg_state_value(VALUE self)
|
37
|
+
{
|
38
|
+
Lexer* lexer = GET_LEXER(self);
|
39
|
+
return INT2NUM(stack_state_value(&lexer->cmdarg));
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE lexer_set_cmdarg_state(VALUE self, VALUE value)
|
43
|
+
{
|
44
|
+
Lexer* lexer = GET_LEXER(self);
|
45
|
+
stack_set_value(&lexer->cmdarg, NUM2INT(value));
|
46
|
+
return Qtrue;
|
47
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
static VALUE lexer_push_cond_state(VALUE self, VALUE bit)
|
2
|
+
{
|
3
|
+
Lexer* lexer = GET_LEXER(self);
|
4
|
+
int bitval = RTEST(bit) ? 1 : 0;
|
5
|
+
stack_state_push(&lexer->cond, bitval);
|
6
|
+
return Qnil;
|
7
|
+
}
|
8
|
+
|
9
|
+
static VALUE lexer_pop_cond_state(VALUE self)
|
10
|
+
{
|
11
|
+
Lexer* lexer = GET_LEXER(self);
|
12
|
+
stack_state_pop(&lexer->cond);
|
13
|
+
return Qnil;
|
14
|
+
}
|
15
|
+
|
16
|
+
static VALUE lexer_lexpop_cond_state(VALUE self)
|
17
|
+
{
|
18
|
+
Lexer* lexer = GET_LEXER(self);
|
19
|
+
stack_state_lexpop(&lexer->cond);
|
20
|
+
return Qnil;
|
21
|
+
}
|
22
|
+
|
23
|
+
static VALUE lexer_clear_cond_state(VALUE self)
|
24
|
+
{
|
25
|
+
Lexer* lexer = GET_LEXER(self);
|
26
|
+
stack_state_clear(&lexer->cond);
|
27
|
+
return Qnil;
|
28
|
+
}
|
29
|
+
|
30
|
+
static VALUE lexer_cond_state_empty_p(VALUE self)
|
31
|
+
{
|
32
|
+
Lexer* lexer = GET_LEXER(self);
|
33
|
+
return stack_state_empty_p(&lexer->cond) ? Qtrue : Qfalse;
|
34
|
+
}
|
35
|
+
|
36
|
+
static VALUE lexer_cond_state_value(VALUE self)
|
37
|
+
{
|
38
|
+
Lexer* lexer = GET_LEXER(self);
|
39
|
+
return INT2NUM(stack_state_value(&lexer->cond));
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE lexer_set_cond_state(VALUE self, VALUE value)
|
43
|
+
{
|
44
|
+
Lexer* lexer = GET_LEXER(self);
|
45
|
+
stack_set_value(&lexer->cond, NUM2INT(value));
|
46
|
+
return Qtrue;
|
47
|
+
}
|
File without changes
|
@@ -32,9 +32,9 @@ static inline void stack_state_clear(stack_state *ss)
|
|
32
32
|
*ss = 0;
|
33
33
|
}
|
34
34
|
|
35
|
-
static inline
|
35
|
+
static inline int stack_state_empty_p(stack_state *ss)
|
36
36
|
{
|
37
|
-
return *ss == 0
|
37
|
+
return *ss == 0;
|
38
38
|
}
|
39
39
|
|
40
40
|
static inline int stack_state_value(stack_state *ss)
|
data/lib/c_lexer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c_lexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Bylich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.5.
|
33
|
+
version: 2.5.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.5.
|
40
|
+
version: 2.5.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,18 +156,18 @@ files:
|
|
156
156
|
- bin/console
|
157
157
|
- bin/setup
|
158
158
|
- c_lexer.gemspec
|
159
|
-
- ext/lexer/cmdarg.h
|
160
|
-
- ext/lexer/cond.h
|
161
159
|
- ext/lexer/emit_tables.h
|
162
160
|
- ext/lexer/extconf.rb
|
163
161
|
- ext/lexer/lexer.c
|
164
162
|
- ext/lexer/lexer.h
|
165
163
|
- ext/lexer/lexer.rl
|
166
|
-
- ext/lexer/literal.h
|
164
|
+
- ext/lexer/literal/literal.h
|
167
165
|
- ext/lexer/literal/methods.h
|
168
166
|
- ext/lexer/literal/type.h
|
169
|
-
- ext/lexer/
|
170
|
-
- ext/lexer/stack_state.h
|
167
|
+
- ext/lexer/stack_state/cmdarg.h
|
168
|
+
- ext/lexer/stack_state/cond.h
|
169
|
+
- ext/lexer/stack_state/stack.h
|
170
|
+
- ext/lexer/stack_state/stack_state.h
|
171
171
|
- lib/c_lexer.rb
|
172
172
|
- lib/c_lexer/version.rb
|
173
173
|
homepage: https://github.com/iliabylich/c_lexer
|
data/ext/lexer/cmdarg.h
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
static VALUE lexer_push_cmdarg_state(VALUE self, VALUE bit)
|
2
|
-
{
|
3
|
-
INIT_LEXER_STATE(self, state);
|
4
|
-
int bitval = RTEST(bit) ? 1 : 0;
|
5
|
-
stack_state_push(&state->cmdarg, bitval);
|
6
|
-
return Qnil;
|
7
|
-
}
|
8
|
-
|
9
|
-
static VALUE lexer_pop_cmdarg_state(VALUE self)
|
10
|
-
{
|
11
|
-
INIT_LEXER_STATE(self, state);
|
12
|
-
stack_state_pop(&state->cmdarg);
|
13
|
-
return Qnil;
|
14
|
-
}
|
15
|
-
|
16
|
-
static VALUE lexer_lexpop_cmdarg_state(VALUE self)
|
17
|
-
{
|
18
|
-
INIT_LEXER_STATE(self, state);
|
19
|
-
stack_state_lexpop(&state->cmdarg);
|
20
|
-
return Qnil;
|
21
|
-
}
|
22
|
-
|
23
|
-
static VALUE lexer_clear_cmdarg_state(VALUE self)
|
24
|
-
{
|
25
|
-
INIT_LEXER_STATE(self, state);
|
26
|
-
stack_state_clear(&state->cmdarg);
|
27
|
-
return Qnil;
|
28
|
-
}
|
29
|
-
|
30
|
-
static VALUE lexer_cmdarg_state_empty_p(VALUE self)
|
31
|
-
{
|
32
|
-
INIT_LEXER_STATE(self, state);
|
33
|
-
return stack_state_empty_p(&state->cmdarg);
|
34
|
-
}
|
35
|
-
|
36
|
-
static VALUE lexer_cmdarg_state_value(VALUE self)
|
37
|
-
{
|
38
|
-
INIT_LEXER_STATE(self, state);
|
39
|
-
return INT2NUM(stack_state_value(&state->cmdarg));
|
40
|
-
}
|
41
|
-
|
42
|
-
static VALUE lexer_set_cmdarg_state(VALUE self, VALUE value)
|
43
|
-
{
|
44
|
-
INIT_LEXER_STATE(self, state);
|
45
|
-
stack_set_value(&state->cmdarg, NUM2INT(value));
|
46
|
-
return Qtrue;
|
47
|
-
}
|
data/ext/lexer/cond.h
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
static VALUE lexer_push_cond_state(VALUE self, VALUE bit)
|
2
|
-
{
|
3
|
-
INIT_LEXER_STATE(self, state);
|
4
|
-
int bitval = RTEST(bit) ? 1 : 0;
|
5
|
-
stack_state_push(&state->cond, bitval);
|
6
|
-
return Qnil;
|
7
|
-
}
|
8
|
-
|
9
|
-
static VALUE lexer_pop_cond_state(VALUE self)
|
10
|
-
{
|
11
|
-
INIT_LEXER_STATE(self, state);
|
12
|
-
stack_state_pop(&state->cond);
|
13
|
-
return Qnil;
|
14
|
-
}
|
15
|
-
|
16
|
-
static VALUE lexer_lexpop_cond_state(VALUE self)
|
17
|
-
{
|
18
|
-
INIT_LEXER_STATE(self, state);
|
19
|
-
stack_state_lexpop(&state->cond);
|
20
|
-
return Qnil;
|
21
|
-
}
|
22
|
-
|
23
|
-
static VALUE lexer_clear_cond_state(VALUE self)
|
24
|
-
{
|
25
|
-
INIT_LEXER_STATE(self, state);
|
26
|
-
stack_state_clear(&state->cond);
|
27
|
-
return Qnil;
|
28
|
-
}
|
29
|
-
|
30
|
-
static VALUE lexer_cond_state_empty_p(VALUE self)
|
31
|
-
{
|
32
|
-
INIT_LEXER_STATE(self, state);
|
33
|
-
return stack_state_empty_p(&state->cond);
|
34
|
-
}
|
35
|
-
|
36
|
-
static VALUE lexer_cond_state_value(VALUE self)
|
37
|
-
{
|
38
|
-
INIT_LEXER_STATE(self, state);
|
39
|
-
return INT2NUM(stack_state_value(&state->cond));
|
40
|
-
}
|
41
|
-
|
42
|
-
static VALUE lexer_set_cond_state(VALUE self, VALUE value)
|
43
|
-
{
|
44
|
-
INIT_LEXER_STATE(self, state);
|
45
|
-
stack_set_value(&state->cond, NUM2INT(value));
|
46
|
-
return Qtrue;
|
47
|
-
}
|