summaryrefslogtreecommitdiff
path: root/src/lexer2.mll
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-08-16 19:26:04 +0100
committerAlasdair Armstrong2017-08-16 19:26:04 +0100
commit9f013687086937df8be81dd6a0ebd86fc750abf7 (patch)
tree91c60d0b9f363bdffe3ac1b1d440b839162dd819 /src/lexer2.mll
parent3a61ca53dd501b501bcc6e076aac11243c38880a (diff)
Added the feature to bind type variables in patterns.
The reason you want this is to do something like (note new parser only): ********* default Order dec type bits 'n:Int = vector('n - 1, 'n, dec, bit) val zeros : forall 'n. atom('n) -> bits('n) val decode : bool -> unit function decode b = { let 'datasize: {|32, 64|} = if b then 32 else 64; let imm: bits('datasize) = zeros(datasize); () } ********* for the ASL decode functions, where the typechecker now knows that the datasize variable and the length of imm are the same.
Diffstat (limited to 'src/lexer2.mll')
-rw-r--r--src/lexer2.mll4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lexer2.mll b/src/lexer2.mll
index 4f4a8be2..f5350ea8 100644
--- a/src/lexer2.mll
+++ b/src/lexer2.mll
@@ -192,7 +192,6 @@ rule token = parse
token lexbuf }
| "&" { (Amp(r"&")) }
| "@" { (At "@") }
- | "|" { Bar }
| "2" ws "^" { TwoCaret }
| "^" { (Caret(r"^")) }
| ":" { Colon(r ":") }
@@ -207,6 +206,9 @@ rule token = parse
| ";" { Semi }
| "*" { (Star(r"*")) }
| "_" { Under }
+ | "{|" { LcurlyBar }
+ | "|}" { RcurlyBar }
+ | "|" { Bar }
| "{" { Lcurly }
| "}" { Rcurly }
| "()" { Unit(r"()") }