mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Added tuple expressions and patterns.
This commit is contained in:
@@ -41,9 +41,16 @@ internal PCons. Pattern3 ::= "(" Ident [Pattern] ")" ;
|
||||
PRec. Pattern3 ::= "rec" "{" [FieldPattern] "}";
|
||||
|
||||
-- List patterns
|
||||
PList. Pattern3 ::= "[" [PListElem] "]" ;
|
||||
PListElem. PListElem ::= Pattern ;
|
||||
separator PListElem "," ;
|
||||
PEmptyList. Pattern3 ::= "[" "]" ;
|
||||
PList. Pattern3 ::= "[" [CommaPattern] "]" ;
|
||||
|
||||
-- Tuple patterns
|
||||
PTuple. Pattern3 ::= "(" CommaPattern "," [CommaPattern] ")" ;
|
||||
|
||||
-- hack to allow a different [Pattern] from the one defined
|
||||
-- for constructor patterns
|
||||
CommaPattern. CommaPattern ::= Pattern ;
|
||||
separator nonempty CommaPattern "," ;
|
||||
|
||||
-- The pattern matching the Type constant
|
||||
PType. Pattern3 ::= "Type" ;
|
||||
@@ -121,8 +128,12 @@ ERec. Exp13 ::= "rec" "{" [FieldValue] "}" ;
|
||||
FieldValue.FieldValue ::= Ident "=" Exp ;
|
||||
separator FieldValue ";" ;
|
||||
|
||||
EEmptyList.Exp13 ::= "[" "]" ;
|
||||
EList. Exp13 ::= "[" [Exp] "]" ;
|
||||
|
||||
-- n-tuple, where n>=2
|
||||
ETuple. Exp13 ::= "(" Exp "," [Exp] ")" ;
|
||||
|
||||
EVar. Exp13 ::= Ident ;
|
||||
EType. Exp13 ::= "Type" ;
|
||||
EStr. Exp13 ::= String ;
|
||||
@@ -132,4 +143,4 @@ EMeta. Exp13 ::= "?" ;
|
||||
|
||||
coercions Exp 13 ;
|
||||
|
||||
separator Exp "," ;
|
||||
separator nonempty Exp "," ;
|
||||
|
||||
Reference in New Issue
Block a user