···435435 let b = io_redirect b.value in
436436 a @ [ b ]
437437438438+and io_op_default_fd : io_op -> io_number = function
439439+ | Io_op_less -> 0
440440+ | Io_op_lessand -> 0
441441+ | _ -> 1
442442+438443and io_redirect : CST.io_redirect -> io_redirect =
439444 fun x ->
440445 match x with
441446 | IoRedirect_IoFile a ->
442447 let a = io_file a.value in
443443- IoRedirect_IoFile a
448448+ IoRedirect_IoFile (io_op_default_fd (fst a), a)
444449 | IoRedirect_IoNumber_IoFile (a, b) ->
445450 let a = io_number a in
446451 let b = io_file b.value in
447447- IoRedirect_IoNumber_IoFile (a, b)
452452+ IoRedirect_IoFile (a, b)
448453 | IoRedirect_IoHere a ->
449454 let a = io_here a.value in
450450- IoRedirect_IoHere a
455455+ IoRedirect_IoHere (0, a)
451456 | IoRedirect_IoNumber_IoHere (a, b) ->
452457 let a = io_number a in
453458 let b = io_here b.value in
454454- IoRedirect_IoNumber_IoHere (a, b)
459459+ IoRedirect_IoHere (a, b)
455460456461and io_file : CST.io_file -> io_file =
457462 fun x ->
458463 match x with
459464 | IoFile_Less_FileName a ->
460465 let a = filename a.value in
461461- IoFile_Less_FileName a
466466+ (Io_op_less, a)
462467 | IoFile_LessAnd_FileName a ->
463468 let a = filename a.value in
464464- IoFile_LessAnd_FileName a
469469+ (Io_op_lessand, a)
465470 | IoFile_Great_FileName a ->
466471 let a = filename a.value in
467467- IoFile_Great_FileName a
472472+ (Io_op_great, a)
468473 | IoFile_GreatAnd_FileName a ->
469474 let a = filename a.value in
470470- IoFile_GreatAnd_FileName a
475475+ (Io_op_greatand, a)
471476 | IoFile_DGreat_FileName a ->
472477 let a = filename a.value in
473473- IoFile_DGreat_FileName a
478478+ (Io_op_dgreat, a)
474479 | IoFile_LessGreat_FileName a ->
475480 let a = filename a.value in
476476- IoFile_LessGreat_FileName a
481481+ (Io_op_lessgreat, a)
477482 | IoFile_Clobber_FileName a ->
478483 let a = filename a.value in
479479- IoFile_Clobber_FileName a
484484+ (Io_op_clobber, a)
480485481486and filename : CST.filename -> filename =
482487 fun x ->
···718723 (a, b)
719724720725and io_number : CST.io_number -> io_number =
721721- fun x -> match x with IONumber a -> IONumber a
726726+ fun x -> match x with IONumber a -> int_of_string a
722727723728let of_program = program
724729
+1
src/lib/eval.ml
···3838 class default_ctx_fold =
3939 object (_)
4040 inherit [ctx] Ast.fold
4141+ method int _ ctx = ctx
4142 method string _ ctx = ctx
4243 method char _ ctx = ctx
4344 method option f v ctx = Option.fold ~none:ctx ~some:(fun i -> f i ctx) v
+12-13
src/lib/sast.ml
···9191and redirects = io_redirect list
92929393and io_redirect =
9494- | IoRedirect_IoFile of io_file
9595- | IoRedirect_IoNumber_IoFile of io_number * io_file
9696- | IoRedirect_IoHere of io_here
9797- | IoRedirect_IoNumber_IoHere of io_number * io_here
9494+ | IoRedirect_IoFile of io_number * io_file
9595+ | IoRedirect_IoHere of io_number * io_here
98969999-and io_file =
100100- | IoFile_Less_FileName of filename
101101- | IoFile_LessAnd_FileName of filename
102102- | IoFile_Great_FileName of filename
103103- | IoFile_GreatAnd_FileName of filename
104104- | IoFile_DGreat_FileName of filename
105105- | IoFile_LessGreat_FileName of filename
106106- | IoFile_Clobber_FileName of filename
9797+and io_op =
9898+ | Io_op_less
9999+ | Io_op_lessand
100100+ | Io_op_great
101101+ | Io_op_greatand
102102+ | Io_op_dgreat
103103+ | Io_op_lessgreat
104104+ | Io_op_clobber
107105106106+and io_file = io_op * filename
108107and filename = word
109108110109and io_here =
···199198and subshell_kind = SubShellKindBackQuote | SubShellKindParentheses
200199and name = Name of string
201200and assignment_word = name * word
202202-and io_number = IONumber of string
201201+and io_number = int