Problem with syntax of drivers
Hi,
I have written a file for a driver. It contains the line:
syntax type set "Set<%o1>"
Actually I don't known if it is a valid rule but my idea was to get the character between % and the index to change the behavior of the extraction (using function gen_syntax_arguments_prec
).
If this is not a acceptable, ignore this issue.
The file is rejected with the exception: bad argument for int_of_string: o1
It is raised by the function iter_on_syntax_parameters
that expects a string containing an integer just after %.
Currently the code is:
let iter_on_syntax_parameters s f =
let arg s b e =
let i = int_of_string (String.sub s b (e-b)) in
f i in
iter_group opt_search_forward arg s
I suggest to change the inner function as:
let arg s b e =
let s' =
match s.[b] with
| 'a'..'z' -> String.sub s (b + 1) (e - b - 1)
| _ -> String.sub s b (e - b) in
let i = int_of_string s' in
f i in