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.
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 lexer_state lexer_state;
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 lexer_state {
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(lexer_state*, VALUE, VALUE, long, long);
60
- static void emit_comment(lexer_state*, long, long);
61
- static void emit_do(lexer_state*, int, long, long);
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(lexer_state*, long, long);
64
- static VALUE range(lexer_state*, long, long);
65
- static void diagnostic(lexer_state*, VALUE, VALUE, VALUE, VALUE, VALUE);
66
- static int get_codepoint(lexer_state*, long);
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(lexer_state*, VALUE, long, long);
78
- static void emit_rational(lexer_state*, VALUE, long, long);
79
- static void emit_complex(lexer_state*, VALUE, long, long);
80
- static void emit_complex_rational(lexer_state*, VALUE, long, long);
81
- static void emit_float(lexer_state*, VALUE, long, long);
82
- static void emit_complex_float(lexer_state*, VALUE, long, long);
83
- static void emit_int_followed_by_if(lexer_state*, VALUE, long, long);
84
- static void emit_int_followed_by_rescue(lexer_state*, VALUE, long, long);
85
- static void emit_float_followed_by_if(lexer_state*, VALUE, long, long);
86
- static void emit_float_followed_by_rescue(lexer_state*, VALUE, long, long);
87
- static int push_literal(lexer_state*, VALUE, VALUE, long, long, int, int, int);
88
- static int pop_literal(lexer_state*);
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(state, type, tok(state, ts, te), ts, te)
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
- lexer_state *state; \
101
- Data_Get_Struct(self, lexer_state, state); \
102
- return state->name; }
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
- lexer_state *state; \
107
- Data_Get_Struct(self, lexer_state, state); \
108
- return state->name = val; } \
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) \