From 5a18a66763bcc19de117cb83293d7bd25a0ea10c Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Tue, 3 Oct 2023 18:19:15 +0200 Subject: Switched the keyword from string to a sum type --- test/syntax.ml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/syntax.ml b/test/syntax.ml index 8c6334e..be14229 100644 --- a/test/syntax.ml +++ b/test/syntax.ml @@ -330,7 +330,8 @@ let test_comment6 () = "gs 'stat' &!! It should be here, because some of the strigs have to be \ initialized" [ - Ast.Call (_position, "GOSUB", [ Ast.Literal (_position, "stat") ]); + Ast.Call + (_position, Qsp_syntax.T.Gosub, [ Ast.Literal (_position, "stat") ]); Ast.Comment _position; ] @@ -524,7 +525,9 @@ let test_if_inline_act () = statements = [ Ast.Call - (_position, "GOTO", [ Ast.Literal (_position, "go") ]); + ( _position, + Qsp_syntax.T.Goto, + [ Ast.Literal (_position, "go") ] ); ]; }; ] ); @@ -550,7 +553,9 @@ let test_if_inline_act2 () = statements = [ Ast.Call - (_position, "GOTO", [ Ast.Literal (_position, "go") ]); + ( _position, + Qsp_syntax.T.Goto, + [ Ast.Literal (_position, "go") ] ); Ast.Comment _position; ]; }; @@ -583,21 +588,25 @@ let test_precedence3 () = let test_gs () = _test_instruction "gs '123'" - [ Ast.(Call (_position, "GOSUB", [ Literal (_position, "123") ])) ] + [ + Ast.(Call (_position, Qsp_syntax.T.Gosub, [ Literal (_position, "123") ])); + ] let test_gt () = _test_instruction "gt $curloc" [ Ast.Call ( _position, - "GOTO", + Qsp_syntax.T.Goto, [ Ast.Ident { Ast.pos = _position; name = "$CURLOC"; index = None } ] ); ] let test_nl () = _test_instruction "*NL 'It'" - [ Ast.Call (_position, "*NL", [ Ast.Literal (_position, "It") ]) ] + [ + Ast.Call (_position, Qsp_syntax.T.Nl', [ Ast.Literal (_position, "It") ]); + ] let test_function () = _test_instruction "iif(123, 1, 0)" @@ -631,7 +640,7 @@ let test_precedence4 () = (** This should not be a keyword without arguments, followed by an expression *) let test_precedence5 () = - _test_instruction "clear()" Ast.[ Call (_position, "CLEAR", []) ] + _test_instruction "clear()" Ast.[ Call (_position, Qsp_syntax.T.Clear, []) ] let test_precedence6 () = _test_instruction "(1 = 0 and 2 ! 3)" -- cgit v1.2.3