@@ -28,6 +28,7 @@ function caml_lex_array(s) {
28
28
29
29
//Provides: caml_lex_engine
30
30
//Requires: caml_failwith, caml_lex_array, caml_uint8_array_of_bytes
31
+ //Requires: caml_bytes_unsafe_get
31
32
function caml_lex_engine ( tbl , start_state , lexbuf ) {
32
33
var lex_buffer = 2 ;
33
34
var lex_buffer_len = 3 ;
@@ -53,7 +54,7 @@ function caml_lex_engine(tbl, start_state, lexbuf) {
53
54
var c ,
54
55
state = start_state ;
55
56
56
- var buffer = caml_uint8_array_of_bytes ( lexbuf [ lex_buffer ] ) ;
57
+ var buffer = lexbuf [ lex_buffer ] ;
57
58
58
59
if ( state >= 0 ) {
59
60
/* First entry */
@@ -79,7 +80,7 @@ function caml_lex_engine(tbl, start_state, lexbuf) {
79
80
else c = 256 ;
80
81
} else {
81
82
/* Read next input char */
82
- c = buffer [ lexbuf [ lex_curr_pos ] ] ;
83
+ c = caml_bytes_unsafe_get ( buffer , lexbuf [ lex_curr_pos ] ) ;
83
84
lexbuf [ lex_curr_pos ] ++ ;
84
85
}
85
86
/* Determine next state */
@@ -106,6 +107,7 @@ function caml_lex_engine(tbl, start_state, lexbuf) {
106
107
//Provides: caml_new_lex_engine
107
108
//Requires: caml_failwith, caml_lex_array
108
109
//Requires: caml_jsbytes_of_string, caml_uint8_array_of_bytes
110
+ //Requires: caml_bytes_unsafe_get
109
111
function caml_lex_run_mem ( s , i , mem , curr_pos ) {
110
112
for ( ; ; ) {
111
113
var dst = s . charCodeAt ( i ) ;
@@ -171,7 +173,7 @@ function caml_new_lex_engine(tbl, start_state, lexbuf) {
171
173
var c ,
172
174
state = start_state ;
173
175
174
- var buffer = caml_uint8_array_of_bytes ( lexbuf [ lex_buffer ] ) ;
176
+ var buffer = lexbuf [ lex_buffer ] ;
175
177
176
178
if ( state >= 0 ) {
177
179
/* First entry */
@@ -203,7 +205,7 @@ function caml_new_lex_engine(tbl, start_state, lexbuf) {
203
205
else c = 256 ;
204
206
} else {
205
207
/* Read next input char */
206
- c = buffer [ lexbuf [ lex_curr_pos ] ] ;
208
+ c = caml_bytes_unsafe_get ( buffer , lexbuf [ lex_curr_pos ] ) ;
207
209
lexbuf [ lex_curr_pos ] ++ ;
208
210
}
209
211
/* Determine next state */
0 commit comments