summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/mod_student/parser.mly15
1 files changed, 7 insertions, 8 deletions
diff --git a/source/mod_student/parser.mly b/source/mod_student/parser.mly
index 7949ec8..c79181e 100644
--- a/source/mod_student/parser.mly
+++ b/source/mod_student/parser.mly
@@ -142,16 +142,10 @@ expression_unary:
{EXPR_Unop {tag=mkTag ();loc=mkLocation $startpos;
op=op;sub=right } }
expression_highest_prec:
- | node=expression_index { node }
+ | node=expression_base { node }
| node=expression_call { node }
| node=expression_length { node }
-expression_index:
- | sub=expression_base index=option( delimited(LSBRACKET,expression,RSBRACKET) )
- {
- match index with
- | None -> sub
- | Some index -> EXPR_Index {tag=mkTag (); loc=mkLocation $startpos; expr=sub; index=index}
- }
+ | node=expression_index { node }
expression_base:
| node=expression_identifier { node }
| node=expression_integer { node }
@@ -160,6 +154,11 @@ expression_base:
| node=expression_bool { node }
| node=expression_struct { node }
| LPAREN node=expression RPAREN { node }
+expression_index:
+ | sub=expression_base index=delimited(LSBRACKET,expression,RSBRACKET)
+ { EXPR_Index {tag=mkTag (); loc=mkLocation $startpos; expr=sub; index=index} }
+ | sub=expression_index index=delimited(LSBRACKET,expression,RSBRACKET)
+ { EXPR_Index {tag=mkTag (); loc=mkLocation $startpos; expr=sub; index=index} }
expression_identifier:
| id=identifier { EXPR_Id {tag= mkTag ();loc=mkLocation $startpos;
id=id} }