Skip to content

Commit 1de27f6

Browse files
committed
clean up lexing runtime
1 parent 4da352c commit 1de27f6

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

jscomp/runtime/caml_lexer.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,12 @@ function caml_lex_array(s) {
104104
*)
105105
let caml_lex_engine_aux : lex_tables -> int -> lexbuf -> exn -> int = [%raw{|function (tbl, start_state, lexbuf, exn){
106106

107-
if (!tbl.processed) {
107+
if (!Array.isArray(tbl.lex_default)) {
108108
tbl.lex_base = caml_lex_array(tbl.lex_base);
109109
tbl.lex_backtrk = caml_lex_array(tbl.lex_backtrk);
110110
tbl.lex_check = caml_lex_array(tbl.lex_check);
111111
tbl.lex_trans = caml_lex_array(tbl.lex_trans);
112-
tbl.lex_default = caml_lex_array(tbl.lex_default);
113-
tbl.processed = true;
112+
tbl.lex_default = caml_lex_array(tbl.lex_default);
114113
}
115114
var c;
116115
var state = start_state;
@@ -240,18 +239,19 @@ function caml_lex_run_tag(s, i, mem) {
240239

241240
let caml_new_lex_engine_aux : lex_tables -> int -> lexbuf -> exn -> int= [%raw{|function (tbl, start_state, lexbuf, exn) {
242241

243-
if (!tbl.processed) {
242+
if (!Array.isArray(tbl.lex_default)) {
244243
tbl.lex_base = caml_lex_array(tbl.lex_base);
245244
tbl.lex_backtrk = caml_lex_array(tbl.lex_backtrk);
246245
tbl.lex_check = caml_lex_array(tbl.lex_check);
247246
tbl.lex_trans = caml_lex_array(tbl.lex_trans);
248247
tbl.lex_default = caml_lex_array(tbl.lex_default);
248+
}
249+
if(!Array.isArray(tbl.lex_default_code)){
249250
tbl.lex_base_code = caml_lex_array(tbl.lex_base_code);
250251
tbl.lex_backtrk_code = caml_lex_array(tbl.lex_backtrk_code);
251252
tbl.lex_check_code = caml_lex_array(tbl.lex_check_code);
252253
tbl.lex_trans_code = caml_lex_array(tbl.lex_trans_code);
253254
tbl.lex_default_code = caml_lex_array(tbl.lex_default_code);
254-
tbl.processed = true;
255255
}
256256
var c, state = start_state;
257257
//var buffer = caml_bytes_of_string(lexbuf.lex_buffer);

lib/es6/caml_lexer.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ function caml_lex_array(s) {
3333

3434
var caml_lex_engine_aux = (function (tbl, start_state, lexbuf, exn){
3535

36-
if (!tbl.processed) {
36+
if (!Array.isArray(tbl.lex_default)) {
3737
tbl.lex_base = caml_lex_array(tbl.lex_base);
3838
tbl.lex_backtrk = caml_lex_array(tbl.lex_backtrk);
3939
tbl.lex_check = caml_lex_array(tbl.lex_check);
4040
tbl.lex_trans = caml_lex_array(tbl.lex_trans);
41-
tbl.lex_default = caml_lex_array(tbl.lex_default);
42-
tbl.processed = true;
41+
tbl.lex_default = caml_lex_array(tbl.lex_default);
4342
}
4443
var c;
4544
var state = start_state;
@@ -159,18 +158,19 @@ function caml_lex_run_tag(s, i, mem) {
159158

160159
var caml_new_lex_engine_aux = (function (tbl, start_state, lexbuf, exn) {
161160

162-
if (!tbl.processed) {
161+
if (!Array.isArray(tbl.lex_default)) {
163162
tbl.lex_base = caml_lex_array(tbl.lex_base);
164163
tbl.lex_backtrk = caml_lex_array(tbl.lex_backtrk);
165164
tbl.lex_check = caml_lex_array(tbl.lex_check);
166165
tbl.lex_trans = caml_lex_array(tbl.lex_trans);
167166
tbl.lex_default = caml_lex_array(tbl.lex_default);
167+
}
168+
if(!Array.isArray(tbl.lex_default_code)){
168169
tbl.lex_base_code = caml_lex_array(tbl.lex_base_code);
169170
tbl.lex_backtrk_code = caml_lex_array(tbl.lex_backtrk_code);
170171
tbl.lex_check_code = caml_lex_array(tbl.lex_check_code);
171172
tbl.lex_trans_code = caml_lex_array(tbl.lex_trans_code);
172173
tbl.lex_default_code = caml_lex_array(tbl.lex_default_code);
173-
tbl.processed = true;
174174
}
175175
var c, state = start_state;
176176
//var buffer = caml_bytes_of_string(lexbuf.lex_buffer);

lib/js/caml_lexer.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ function caml_lex_array(s) {
3333

3434
var caml_lex_engine_aux = (function (tbl, start_state, lexbuf, exn){
3535

36-
if (!tbl.processed) {
36+
if (!Array.isArray(tbl.lex_default)) {
3737
tbl.lex_base = caml_lex_array(tbl.lex_base);
3838
tbl.lex_backtrk = caml_lex_array(tbl.lex_backtrk);
3939
tbl.lex_check = caml_lex_array(tbl.lex_check);
4040
tbl.lex_trans = caml_lex_array(tbl.lex_trans);
41-
tbl.lex_default = caml_lex_array(tbl.lex_default);
42-
tbl.processed = true;
41+
tbl.lex_default = caml_lex_array(tbl.lex_default);
4342
}
4443
var c;
4544
var state = start_state;
@@ -159,18 +158,19 @@ function caml_lex_run_tag(s, i, mem) {
159158

160159
var caml_new_lex_engine_aux = (function (tbl, start_state, lexbuf, exn) {
161160

162-
if (!tbl.processed) {
161+
if (!Array.isArray(tbl.lex_default)) {
163162
tbl.lex_base = caml_lex_array(tbl.lex_base);
164163
tbl.lex_backtrk = caml_lex_array(tbl.lex_backtrk);
165164
tbl.lex_check = caml_lex_array(tbl.lex_check);
166165
tbl.lex_trans = caml_lex_array(tbl.lex_trans);
167166
tbl.lex_default = caml_lex_array(tbl.lex_default);
167+
}
168+
if(!Array.isArray(tbl.lex_default_code)){
168169
tbl.lex_base_code = caml_lex_array(tbl.lex_base_code);
169170
tbl.lex_backtrk_code = caml_lex_array(tbl.lex_backtrk_code);
170171
tbl.lex_check_code = caml_lex_array(tbl.lex_check_code);
171172
tbl.lex_trans_code = caml_lex_array(tbl.lex_trans_code);
172173
tbl.lex_default_code = caml_lex_array(tbl.lex_default_code);
173-
tbl.processed = true;
174174
}
175175
var c, state = start_state;
176176
//var buffer = caml_bytes_of_string(lexbuf.lex_buffer);

0 commit comments

Comments
 (0)