c_lexer 2.5.1.2.0 → 2.5.3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
data/ext/lexer/lexer.h
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#ifndef LEXER_H
|
2
2
|
#define LEXER_H
|
3
3
|
|
4
|
-
typedef struct
|
5
|
-
#include "literal.h"
|
4
|
+
typedef struct Lexer Lexer;
|
5
|
+
#include "literal/literal.h"
|
6
6
|
define_stack_type(lit_stack, literal, {0});
|
7
7
|
|
8
|
-
struct
|
8
|
+
struct Lexer {
|
9
9
|
int cs; /* DFA state */
|
10
10
|
long p; /* stream position */
|
11
11
|
long pe; /* end-of-stream position */
|
@@ -56,14 +56,14 @@ static void lexer_mark(void*);
|
|
56
56
|
static void lexer_dealloc(void*);
|
57
57
|
static VALUE lexer_reset(int, VALUE*, VALUE);
|
58
58
|
|
59
|
-
static void emit_token(
|
60
|
-
static void emit_comment(
|
61
|
-
static void emit_do(
|
59
|
+
static void emit_token(Lexer*, VALUE, VALUE, long, long);
|
60
|
+
static void emit_comment(Lexer*, long, long);
|
61
|
+
static void emit_do(Lexer*, int, long, long);
|
62
62
|
|
63
|
-
static VALUE tok(
|
64
|
-
static VALUE range(
|
65
|
-
static void diagnostic(
|
66
|
-
static int get_codepoint(
|
63
|
+
static VALUE tok(Lexer*, long, long);
|
64
|
+
static VALUE range(Lexer*, long, long);
|
65
|
+
static void diagnostic(Lexer*, VALUE, VALUE, VALUE, VALUE, VALUE);
|
66
|
+
static int get_codepoint(Lexer*, long);
|
67
67
|
static int arg_or_cmdarg(int);
|
68
68
|
static int is_nthref(VALUE);
|
69
69
|
static int is_backref(VALUE);
|
@@ -74,18 +74,18 @@ static VALUE find_unknown_options(VALUE);
|
|
74
74
|
static int bad_cvar_name(VALUE);
|
75
75
|
static int bad_ivar_name(VALUE);
|
76
76
|
static int find_8_or_9(VALUE str);
|
77
|
-
static void emit_int(
|
78
|
-
static void emit_rational(
|
79
|
-
static void emit_complex(
|
80
|
-
static void emit_complex_rational(
|
81
|
-
static void emit_float(
|
82
|
-
static void emit_complex_float(
|
83
|
-
static void emit_int_followed_by_if(
|
84
|
-
static void emit_int_followed_by_rescue(
|
85
|
-
static void emit_float_followed_by_if(
|
86
|
-
static void emit_float_followed_by_rescue(
|
87
|
-
static int push_literal(
|
88
|
-
static int pop_literal(
|
77
|
+
static void emit_int(Lexer*, VALUE, long, long);
|
78
|
+
static void emit_rational(Lexer*, VALUE, long, long);
|
79
|
+
static void emit_complex(Lexer*, VALUE, long, long);
|
80
|
+
static void emit_complex_rational(Lexer*, VALUE, long, long);
|
81
|
+
static void emit_float(Lexer*, VALUE, long, long);
|
82
|
+
static void emit_complex_float(Lexer*, VALUE, long, long);
|
83
|
+
static void emit_int_followed_by_if(Lexer*, VALUE, long, long);
|
84
|
+
static void emit_int_followed_by_rescue(Lexer*, VALUE, long, long);
|
85
|
+
static void emit_float_followed_by_if(Lexer*, VALUE, long, long);
|
86
|
+
static void emit_float_followed_by_rescue(Lexer*, VALUE, long, long);
|
87
|
+
static int push_literal(Lexer*, VALUE, VALUE, long, long, int, int, int);
|
88
|
+
static int pop_literal(Lexer*);
|
89
89
|
static VALUE array_last(VALUE);
|
90
90
|
static VALUE unescape_char(char);
|
91
91
|
static VALUE escape_char(VALUE);
|
@@ -93,19 +93,19 @@ static inline int str_start_with_p(VALUE, const char*);
|
|
93
93
|
static inline int str_end_with_p(VALUE, const char*);
|
94
94
|
static inline void force_encoding(VALUE, VALUE);
|
95
95
|
|
96
|
-
#define emit(type) emit_token(
|
96
|
+
#define emit(type) emit_token(lexer, type, tok(lexer, ts, te), ts, te)
|
97
97
|
|
98
98
|
#define def_lexer_attr_reader(name) \
|
99
99
|
static VALUE lexer_get_ ## name(VALUE self) { \
|
100
|
-
|
101
|
-
Data_Get_Struct(self,
|
102
|
-
return
|
100
|
+
Lexer *lexer; \
|
101
|
+
Data_Get_Struct(self, Lexer, lexer); \
|
102
|
+
return lexer->name; }
|
103
103
|
|
104
104
|
#define def_lexer_attr_writer(name) \
|
105
105
|
static VALUE lexer_set_ ## name(VALUE self, VALUE val) { \
|
106
|
-
|
107
|
-
Data_Get_Struct(self,
|
108
|
-
return
|
106
|
+
Lexer *lexer; \
|
107
|
+
Data_Get_Struct(self, Lexer, lexer); \
|
108
|
+
return lexer->name = val; } \
|
109
109
|
|
110
110
|
#define def_lexer_attribute(name) \
|
111
111
|
def_lexer_attr_reader(name) \
|