diff options
author | Chimrod <> | 2023-11-03 15:16:21 +0100 |
---|---|---|
committer | Chimrod <> | 2023-11-03 15:16:21 +0100 |
commit | f5d06b0e8e6aaaa05100165bfc7873d2a8be859c (patch) | |
tree | 94a129a9fda6672abc6281cb7bb8f31b6eece433 /lib | |
parent | 180529c30282d39f3506633716e3fe439db03309 (diff) |
Added the /= operator
Diffstat (limited to 'lib')
-rw-r--r-- | lib/qparser/lexer.ml | 1 | ||||
-rw-r--r-- | lib/qparser/qsp_instruction.mly | 1 | ||||
-rw-r--r-- | lib/qparser/tokens.mly | 2 | ||||
-rw-r--r-- | lib/syntax/t.ml | 7 |
4 files changed, 9 insertions, 2 deletions
diff --git a/lib/qparser/lexer.ml b/lib/qparser/lexer.ml index 8f3645c..b133a8e 100644 --- a/lib/qparser/lexer.ml +++ b/lib/qparser/lexer.ml @@ -211,6 +211,7 @@ let rec parse_token : Lexbuf.t -> token = | "+=" -> INCR | "-=" -> DECR | "*=" -> MULT_EQUAL + | "/=" -> DIV_EQUAL | '/' -> DIV | '*' -> STAR | ':' -> diff --git a/lib/qparser/qsp_instruction.mly b/lib/qparser/qsp_instruction.mly index b7d2558..ddcbb8d 100644 --- a/lib/qparser/qsp_instruction.mly +++ b/lib/qparser/qsp_instruction.mly @@ -85,6 +85,7 @@ assignation_operator: | INCR { T.Inc } | DECR { T.Decr } | MULT_EQUAL { T.Mult } + | DIV_EQUAL { T.Div_assign } inline_instruction: | hd = inline_instruction diff --git a/lib/qparser/tokens.mly b/lib/qparser/tokens.mly index 6612351..ddbc4cf 100644 --- a/lib/qparser/tokens.mly +++ b/lib/qparser/tokens.mly @@ -4,7 +4,7 @@ %token PLUS %token MINUS %token INCR DECR -%token MULT_EQUAL +%token MULT_EQUAL DIV_EQUAL %token STAR %token DIV %token MOD diff --git a/lib/syntax/t.ml b/lib/syntax/t.ml index ade5e11..7186275 100644 --- a/lib/syntax/t.ml +++ b/lib/syntax/t.ml @@ -22,7 +22,12 @@ type boperator = and uoperator = No | Neg | Add [@@deriving eq, show] -and assignation_operator = Eq' | Inc (** += *) | Decr (** -= *) | Mult +and assignation_operator = + | Eq' + | Inc (** += *) + | Decr (** -= *) + | Mult + | Div_assign [@@deriving eq, show] type function_ = |