Permalink
Browse files

added measure literal rules

  • Loading branch information...
1 parent b3afe84 commit 10ac0de457c9f80842481cfccb278a43b650e5ec @alexbiehl committed Apr 6, 2013
Showing with 69 additions and 9 deletions.
  1. +69 −9 src/main/antlr3/fjord/compiler/Fsharp.g
@@ -812,6 +812,68 @@ interfaceSpec
: Interface type
;
+/*
+ * A.2.6 Units Of Measure
+ */
+
+measureLiteralAtom
+ : longIdent
+ | LParen measureLiteralSimp RParen
+ ;
+
+measureLiteralPower
+ : measureLiteralAtom ('^' Int32)?
+ ;
+
+measureLiteralSeq
+ : measureLiteralPower+
+ ;
+
+measureLiteralSimp
+ : (measureLiteralSeq
+ | '/' measureLiteralSimp
+ | '1'
+ )
+ (
+ | '*' measureLiteralSimp
+ | '/' measureLiteralSimp
+ )?
+ ;
+
+measureLiteral
+ : Underscore
+ | measureLiteralSimp
+ ;
+
+measureAtom
+ : typar
+ | longIdent
+ | LParen measureSimp RParen
+ ;
+
+measurePower
+ : measureAtom ('^' Int32)?
+ ;
+
+measureSeq
+ : measurePower+
+ ;
+
+measureSimp
+ : (measureSeq
+ | '/' measureSimp
+ | '1'
+ )
+ (
+ | '*' measureSimp
+ | '/' measureSimp
+ )?
+ ;
+
+measure
+ : Underscore
+ | measureSimp
+ ;
/*
* A.2.7 Custom attributes and reflection
@@ -2600,13 +2662,11 @@ constant returns [Node n]
| False { $n = new Const($False.text); }
| True { $n = new Const($True.text); }
| '()' { $n = new Const("()"); }
-/*
- | Sbyte '<' MeasureLiteral '>'
- | Int16 '<' MeasureLiteral '>'
- | Int32 '<' MeasureLiteral '>'
- | Int64 '<' MeasureLiteral '>'
- | Ieee32 '<' MeasureLiteral '>'
- | Ieee64 '<' MeasureLiteral '>'
- | Decimal '<' MeasureLiteral '>'
-*/
+ | Sbyte '<' measureLiteral '>'
+ | Int16 '<' measureLiteral '>'
+ | Int32 '<' measureLiteral '>'
+ | Int64 '<' measureLiteral '>'
+ | Ieee32 '<' measureLiteral '>'
+ | Ieee64 '<' measureLiteral '>'
+ | Decimal '<' measureLiteral '>'
;

0 comments on commit 10ac0de

Please sign in to comment.