Fixed helpers.ml and promoted negative test of reserved name for PascaLIGO.

This commit is contained in:
Christian Rinderknecht 2020-01-22 12:47:11 +01:00
parent d46d95ee90
commit a2a35cc953
2 changed files with 9 additions and 9 deletions

View File

@ -99,9 +99,9 @@ ligo: lexer error: Negative byte sequence.
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.ligo" ; "main" ] ; run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.ligo" ; "main" ] ;
[%expect {| [%expect {|
ligo: lexer error: Reserved name: args. ligo: lexer error: Reserved name: arguments.
Hint: Change the name. Hint: Change the name.
{"parser_loc":"in file \"reserved_name.ligo\", line 1, characters 4-8"} {"parser_loc":"in file \"reserved_name.ligo\", line 1, characters 4-13"}
If you're not sure how to fix this error, you can If you're not sure how to fix this error, you can

View File

@ -134,27 +134,27 @@ let parsify_string = fun (syntax : v_syntax) source_filename ->
let%bind applied = Self_ast_simplified.all_program parsified in let%bind applied = Self_ast_simplified.all_program parsified in
ok applied ok applied
let pretty_print_pascaligo = fun source -> let pretty_print_pascaligo = fun source ->
let%bind ast = Parser.Pascaligo.parse_file source in let%bind ast = Parser.Pascaligo.parse_file source in
let buffer = Buffer.create 59 in let buffer = Buffer.create 59 in
let state = Parser.Pascaligo.ParserLog.mk_state let state = Parser_pascaligo.ParserLog.mk_state
~offsets:true ~offsets:true
~mode:`Byte ~mode:`Byte
~buffer in ~buffer in
Parser.Pascaligo.ParserLog.pp_ast state ast; Parser_pascaligo.ParserLog.pp_ast state ast;
ok buffer ok buffer
let pretty_print_cameligo = fun source -> let pretty_print_cameligo = fun source ->
let%bind ast = Parser.Cameligo.parse_file source in let%bind ast = Parser.Cameligo.parse_file source in
let buffer = Buffer.create 59 in let buffer = Buffer.create 59 in
let state = Parser.Cameligo.ParserLog.mk_state let state = Parser_cameligo.ParserLog.mk_state
~offsets:true ~offsets:true
~mode:`Byte ~mode:`Byte
~buffer in ~buffer in
Parser.Cameligo.ParserLog.pp_ast state ast; Parser.Cameligo.ParserLog.pp_ast state ast;
ok buffer ok buffer
let pretty_print_reasonligo = fun source -> let pretty_print_reasonligo = fun source ->
let%bind ast = Parser.Reasonligo.parse_file source in let%bind ast = Parser.Reasonligo.parse_file source in
let buffer = Buffer.create 59 in let buffer = Buffer.create 59 in
let state = Parser.Reasonligo.ParserLog.mk_state let state = Parser.Reasonligo.ParserLog.mk_state
@ -170,4 +170,4 @@ let pretty_print = fun syntax source_filename ->
| Pascaligo -> pretty_print_pascaligo | Pascaligo -> pretty_print_pascaligo
| Cameligo -> pretty_print_cameligo | Cameligo -> pretty_print_cameligo
| ReasonLIGO -> pretty_print_reasonligo) | ReasonLIGO -> pretty_print_reasonligo)
source_filename source_filename