summaryrefslogtreecommitdiff
path: root/ocamltest/tsl_parser.mly
diff options
context:
space:
mode:
Diffstat (limited to 'ocamltest/tsl_parser.mly')
-rw-r--r--ocamltest/tsl_parser.mly33
1 files changed, 29 insertions, 4 deletions
diff --git a/ocamltest/tsl_parser.mly b/ocamltest/tsl_parser.mly
index e6a875a886..c8d52ab72b 100644
--- a/ocamltest/tsl_parser.mly
+++ b/ocamltest/tsl_parser.mly
@@ -31,9 +31,11 @@ let mkenvstmt envstmt =
%}
-%token TSL_BEGIN_C_STYLE TSL_END_C_STYLE
-%token TSL_BEGIN_OCAML_STYLE TSL_END_OCAML_STYLE
-%token COMMA
+%token <[`Above | `Below]> TSL_BEGIN_C_STYLE
+%token TSL_END_C_STYLE
+%token <[`Above | `Below]> TSL_BEGIN_OCAML_STYLE
+%token TSL_END_OCAML_STYLE
+%token COMMA LEFT_BRACE RIGHT_BRACE SEMI
%token <int> TEST_DEPTH
%token EQUAL PLUSEQUAL
/* %token COLON */
@@ -41,11 +43,34 @@ let mkenvstmt envstmt =
%token <string> IDENTIFIER
%token <string> STRING
-%start tsl_block
+%start tsl_block tsl_script
%type <Tsl_ast.tsl_block> tsl_block
+%type <Tsl_ast.t> tsl_script
%%
+node:
+| statement_list tree_list { Ast ($1, $2) }
+
+tree_list:
+| { [] }
+| tree tree_list { $1 :: $2 }
+
+tree:
+| LEFT_BRACE node RIGHT_BRACE { $2 }
+
+statement_list:
+| { [] }
+| statement statement_list { $1 :: $2 }
+
+statement:
+| env_item SEMI { $1 }
+| identifier with_environment_modifiers SEMI { Test (0, $1, $2) }
+
+tsl_script:
+| TSL_BEGIN_C_STYLE node TSL_END_C_STYLE { $2 }
+| TSL_BEGIN_OCAML_STYLE node TSL_END_OCAML_STYLE { $2 }
+
tsl_block:
| TSL_BEGIN_C_STYLE tsl_items TSL_END_C_STYLE { $2 }
| TSL_BEGIN_OCAML_STYLE tsl_items TSL_END_OCAML_STYLE { $2 }