From 9627306473edd281bc26b4e44131ca1507bb68c2 Mon Sep 17 00:00:00 2001 From: Jonathan Brachthäuser Date: Wed, 21 Dec 2016 20:04:23 +0100 Subject: Remove tree annotations --- docs/docs/internals/syntax.md | 180 +++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 90 deletions(-) (limited to 'docs') diff --git a/docs/docs/internals/syntax.md b/docs/docs/internals/syntax.md index 205de4d19..fb8545ad5 100644 --- a/docs/docs/internals/syntax.md +++ b/docs/docs/internals/syntax.md @@ -108,37 +108,37 @@ StableId ::= id | [id '.'] `super' [ClassQualifier] `.' id ClassQualifier ::= `[' id `]' -Type ::= [`implicit'] FunArgTypes `=>' Type Function(ts, t) - | HkTypeParamClause `=>' Type TypeLambda(ps, t) +Type ::= [`implicit'] FunArgTypes `=>' Type + | HkTypeParamClause `=>' Type | InfixType FunArgTypes ::= InfixType | `(' [ FunArgType {`,' FunArgType } ] `)' -InfixType ::= RefinedType {id [nl] RefinedType} InfixOp(t1, op, t2) -RefinedType ::= WithType {[nl] Refinement} RefinedTypeTree(t, ds) -WithType ::= AnnotType {`with' AnnotType} (deprecated) -AnnotType ::= SimpleType {Annotation} Annotated(t, annot) -SimpleType ::= SimpleType (TypeArgs | NamedTypeArgs) AppliedTypeTree(t, args) - | SimpleType `#' id Select(t, name) +InfixType ::= RefinedType {id [nl] RefinedType} +RefinedType ::= WithType {[nl] Refinement} +WithType ::= AnnotType {`with' AnnotType} +AnnotType ::= SimpleType {Annotation} +SimpleType ::= SimpleType (TypeArgs | NamedTypeArgs) + | SimpleType `#' id | StableId - | Path `.' `type' SingletonTypeTree(p) - | `(' ArgTypes ')' Tuple(ts) + | Path `.' `type' + | `(' ArgTypes ')' | `_' TypeBounds - | Refinement RefinedTypeTree(EmptyTree, refinement) - | SimpleLiteral SingletonTypeTree(l) + | Refinement + | SimpleLiteral ArgTypes ::= Type {`,' Type} | NamedTypeArg {`,' NamedTypeArg } FunArgType ::= Type - | `=>' Type PrefixOp(=>, t) + | `=>' Type ParamType ::= [`=>'] ParamValueType -ParamValueType ::= Type [`*'] PostfixOp(t, "*") -TypeArgs ::= `[' ArgTypes `]' ts -NamedTypeArg ::= id `=' Type NamedArg(id, t) -NamedTypeArgs ::= `[' NamedTypeArg {`,' NamedTypeArg} `]' nts -Refinement ::= `{' [Dcl] {semi [Dcl]} `}' ds -TypeBounds ::= [`>:' Type] [`<: Type] | INT TypeBoundsTree(lo, hi) -TypeParamBounds ::= TypeBounds {`<%' Type} {`:' Type} ContextBounds(typeBounds, tps) - -Expr ::= [`implicit'] FunParams `=>' Expr Function(args, expr), Function(ValDef([implicit], id, TypeTree(), EmptyTree), expr) +ParamValueType ::= Type [`*'] +TypeArgs ::= `[' ArgTypes `]' +NamedTypeArg ::= id `=' Type +NamedTypeArgs ::= `[' NamedTypeArg {`,' NamedTypeArg} `]' +Refinement ::= `{' [Dcl] {semi [Dcl]} `}' +TypeBounds ::= [`>:' Type] [`<: Type] | INT +TypeParamBounds ::= TypeBounds {`<%' Type} {`:' Type} + +Expr ::= [`implicit'] FunParams `=>' Expr FunParams ::= Bindings | id | `_' @@ -146,74 +146,74 @@ ExprInParens ::= PostfixExpr `:' Type | Expr BlockResult ::= [`implicit'] FunParams `=>' Block | Expr1 -Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] else Expr] If(Parens(cond), thenp, elsep?) - | `if' Expr `then' Expr [[semi] else Expr] If(cond, thenp, elsep?) - | `while' `(' Expr `)' {nl} Expr WhileDo(Parens(cond), body) - | `while' Expr `do' Expr WhileDo(cond, body) - | `do' Expr [semi] `while' Expr DoWhile(expr, cond) - | `try' Expr Catches [`finally' Expr] Try(expr, catches, expr?) - | `try' Expr [`finally' Expr] Try(expr, Nil, expr?) - | `throw' Expr Throw(expr) - | `return' [Expr] Return(expr?) +Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] else Expr] + | `if' Expr `then' Expr [[semi] else Expr] + | `while' `(' Expr `)' {nl} Expr + | `while' Expr `do' Expr + | `do' Expr [semi] `while' Expr + | `try' Expr Catches [`finally' Expr] + | `try' Expr [`finally' Expr] + | `throw' Expr + | `return' [Expr] | ForExpr - | [SimpleExpr `.'] id `=' Expr Assign(expr, expr) - | SimpleExpr1 ArgumentExprs `=' Expr Assign(expr, expr) + | [SimpleExpr `.'] id `=' Expr + | SimpleExpr1 ArgumentExprs `=' Expr | PostfixExpr [Ascription] - | PostfixExpr `match' `{' CaseClauses `}' Match(expr, cases) -- point on match -Ascription ::= `:' InfixType Typed(expr, tp) - | `:' Annotation {Annotation} Typed(expr, Annotated(EmptyTree, annot)*) + | PostfixExpr `match' `{' CaseClauses `}' +Ascription ::= `:' InfixType + | `:' Annotation {Annotation} Catches ::= `catch' Expr -PostfixExpr ::= InfixExpr [id] PostfixOp(expr, op) +PostfixExpr ::= InfixExpr [id] InfixExpr ::= PrefixExpr - | InfixExpr id [nl] InfixExpr InfixOp(expr, op, expr) -PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr PrefixOp(expr, op) -SimpleExpr ::= `new' Template New(templ) + | InfixExpr id [nl] InfixExpr +PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr +SimpleExpr ::= `new' Template | BlockExpr - | SimpleExpr1 [`_'] PostfixOp(expr, _) + | SimpleExpr1 [`_'] SimpleExpr1 ::= Literal | Path | `_' - | `(' ExprsInParens2 `)' Parens(exprs) - | SimpleExpr `.' id Select(expr, id) - | SimpleExpr (TypeArgs | NamedTypeArgs) TypeApply(expr, args) - | SimpleExpr1 ArgumentExprs Apply(expr, args) + | `(' ExprsInParens2 `)' + | SimpleExpr `.' id + | SimpleExpr (TypeArgs | NamedTypeArgs) + | SimpleExpr1 ArgumentExprs | XmlExpr ExprsInParens ::= ExprInParens {`,' ExprInParens} -ParArgumentExprs ::= `(' [ExprsInParens] `)' exprs - | `(' [ExprsInParens `,'] PostfixExpr `:' `_' `*' ')' exprs :+ Typed(expr, Ident(wildcardStar)) +ParArgumentExprs ::= `(' [ExprsInParens] `)' + | `(' [ExprsInParens `,'] PostfixExpr `:' `_' `*' ')' ArgumentExprs ::= ParArgumentExprs | [nl] BlockExpr -BlockExpr ::= `{' CaseClauses `}' Match(EmptyTree, cases) - | `{' Block `}' block // starts at { -Block ::= {BlockStat semi} [BlockResult] Block(stats, expr?) +BlockExpr ::= `{' CaseClauses `}' + | `{' Block `}' +Block ::= {BlockStat semi} [BlockResult] BlockStat ::= Import | {Annotation} [`implicit' | `lazy'] Def | {Annotation} {LocalModifier} TmplDef | Expr1 | -ForExpr ::= `for' (`(' Enumerators `)' | `{' Enumerators `}') ForYield(enums, expr) - {nl} [`yield'] Expr ForDo(enums, expr) +ForExpr ::= `for' (`(' Enumerators `)' | `{' Enumerators `}') + {nl} [`yield'] Expr | `for' Enumerators (`do' Expr | `yield' Expr) Enumerators ::= Generator {semi Enumerator | Guard} Enumerator ::= Generator | Guard - | Pattern1 `=' Expr GenAlias(pat, expr) -Generator ::= Pattern1 `<-' Expr GenFrom(pat, expr) + | Pattern1 `=' Expr +Generator ::= Pattern1 `<-' Expr Guard ::= `if' PostfixExpr CaseClauses ::= CaseClause { CaseClause } -CaseClause ::= `case' (Pattern [Guard] `=>' Block | INT) CaseDef(pat, guard?, block) // block starts at => +CaseClause ::= `case' (Pattern [Guard] `=>' Block | INT) -Pattern ::= Pattern1 { `|' Pattern1 } Alternative(pats) -Pattern1 ::= PatVar `:' RefinedType Bind(name, Typed(Ident(wildcard), tpe)) +Pattern ::= Pattern1 { `|' Pattern1 } +Pattern1 ::= PatVar `:' RefinedType | Pattern2 -Pattern2 ::= [varid `@'] InfixPattern Bind(name, pat) -InfixPattern ::= SimplePattern { id [nl] SimplePattern } InfixOp(pat, op, pat) -SimplePattern ::= PatVar Ident(wildcard) - | Literal Bind(name, Ident(wildcard)) - | `(' [Patterns] `)' Parens(pats) Tuple(pats) +Pattern2 ::= [varid `@'] InfixPattern +InfixPattern ::= SimplePattern { id [nl] SimplePattern } +SimplePattern ::= PatVar + | Literal + | `(' [Patterns] `)' | XmlPattern | SimplePattern1 [TypeArgs] [ArgumentPatterns] SimplePattern1 ::= Path @@ -222,12 +222,12 @@ SimplePattern1 ::= Path PatVar ::= varid | `_' Patterns ::= Pattern {`,' Pattern} -ArgumentPatterns ::= `(' [Patterns] `)' Apply(fn, pats) +ArgumentPatterns ::= `(' [Patterns] `)' | `(' [Patterns `,'] Pattern2 `:' `_' `*' ') ClsTypeParamClause::= `[' ClsTypeParam {`,' ClsTypeParam} `]' -ClsTypeParam ::= {Annotation} [{Modifier} type] [`+' | `-'] TypeDef(Modifiers, name, tparams, bounds) - id [HkTypeParamClause] TypeParamBounds Bound(below, above, context) +ClsTypeParam ::= {Annotation} [{Modifier} type] [`+' | `-'] + id [HkTypeParamClause] TypeParamBounds DefTypeParamClause::= `[' DefTypeParam {`,' DefTypeParam} `]' DefTypeParam ::= {Annotation} id [HkTypeParamClause] TypeParamBounds @@ -243,17 +243,17 @@ ClsParamClauses ::= {ClsParamClause} [[nl] `(' `implicit' ClsParams `)'] ClsParamClause ::= [nl] `(' [ClsParams] ')' ClsParams ::= ClsParam {`' ClsParam} ClsParam ::= {Annotation} - [{Modifier} (`val' | `var') | `inline'] Param ValDef(mods, id, tpe, expr) -- point of mods on val/var + [{Modifier} (`val' | `var') | `inline'] Param Param ::= id `:' ParamType [`=' Expr] | INT DefParamClauses ::= {DefParamClause} [[nl] `(' `implicit' DefParams `)'] DefParamClause ::= [nl] `(' [DefParams] ')' DefParams ::= DefParam {`,' DefParam} -DefParam ::= {Annotation} [`inline'] Param ValDef(mods, id, tpe, expr) -- point of mods at id. +DefParam ::= {Annotation} [`inline'] Param Bindings ::= `(' Binding {`,' Binding}] `)' -Binding ::= (id | `_') [`:' Type] ValDef(_, id, tpe, EmptyTree) +Binding ::= (id | `_') [`:' Type] Modifier ::= LocalModifier | AccessModifier @@ -266,21 +266,21 @@ LocalModifier ::= `abstract' AccessModifier ::= (`private' | `protected') [AccessQualifier] AccessQualifier ::= `[' (id | `this') `]' -Annotation ::= `@' SimpleType {ParArgumentExprs} Apply(tpe, args) +Annotation ::= `@' SimpleType {ParArgumentExprs} -TemplateBody ::= [nl] `{' [SelfType] TemplateStat {semi TemplateStat} `} (self, stats) +TemplateBody ::= [nl] `{' [SelfType] TemplateStat {semi TemplateStat} `} TemplateStat ::= Import | {Annotation [nl]} {Modifier} Def | {Annotation [nl]} {Modifier} Dcl | Expr1 | -SelfType ::= id [`:' InfixType] `=>' ValDef(_, name, tpt, _) +SelfType ::= id [`:' InfixType] `=>' | `this' `:' InfixType `=> Import ::= `import' ImportExpr {`,' ImportExpr} -ImportExpr ::= StableId `.' (id | `_' | ImportSelectors) Import(expr, sels) +ImportExpr ::= StableId `.' (id | `_' | ImportSelectors) ImportSelectors ::= `{' {ImportSelector `,'} (ImportSelector | `_') `}' -ImportSelector ::= id [`=>' id | `=>' `_'] Ident(name), Pair(id, id) +ImportSelector ::= id [`=>' id | `=>' `_'] Dcl ::= `val' ValDcl | `var' VarDcl @@ -288,12 +288,12 @@ Dcl ::= `val' ValDcl | `type' {nl} TypeDcl | INT -ValDcl ::= ids `:' Type PatDef(_, ids, tpe, EmptyTree) -VarDcl ::= ids `:' Type PatDef(_, ids, tpe, EmptyTree) -DefDcl ::= DefSig [`:' Type] DefDef(_, name, tparams, vparamss, tpe, EmptyTree) +ValDcl ::= ids `:' Type +VarDcl ::= ids `:' Type +DefDcl ::= DefSig [`:' Type] DefSig ::= id [DefTypeParamClause] DefParamClauses -TypeDcl ::= id [TypTypeParamClause] ['=' Type] TypeDefTree(_, name, tparams, tpt) - | id [HkTypeParamClause] TypeBounds TypeDefTree(_, name, tparams, bounds) +TypeDcl ::= id [TypTypeParamClause] ['=' Type] + | id [HkTypeParamClause] TypeBounds Def ::= `val' PatDef | `var' VarDef @@ -301,25 +301,25 @@ Def ::= `val' PatDef | `type' {nl} TypeDcl | TmplDef | INT -PatDef ::= Pattern2 {`,' Pattern2} [`:' Type] `=' Expr PatDef(_, pats, tpe?, expr) +PatDef ::= Pattern2 {`,' Pattern2} [`:' Type] `=' Expr VarDef ::= PatDef | ids `:' Type `=' `_' -DefDef ::= DefSig [`:' Type] `=' Expr DefDef(_, name, tparams, vparamss, tpe, expr) - | DefSig [nl] `{' Block `}' DefDef(_, name, tparams, vparamss, tpe, Block) - | `this' DefParamClause DefParamClauses DefDef(_, , Nil, vparamss, EmptyTree, expr | Block) +DefDef ::= DefSig [`:' Type] `=' Expr + | DefSig [nl] `{' Block `}' + | `this' DefParamClause DefParamClauses (`=' ConstrExpr | [nl] ConstrBlock) TmplDef ::= ([`case'] `class' | `trait') ClassDef | [`case'] `object' ObjectDef -ClassDef ::= id [ClsTypeParamClause] ClassDef(mods, name, tparams, templ) // - [ConstrMods] ClsParamClauses TemplateOpt with DefDef(_, , Nil, vparamss, EmptyTree, EmptyTree) as first stat +ClassDef ::= id [ClsTypeParamClause] + [ConstrMods] ClsParamClauses TemplateOpt ConstrMods ::= AccessModifier | Annotation {Annotation} (AccessModifier | `this') -ObjectDef ::= id TemplateOpt ModuleDef(mods, name, template) // no constructor +ObjectDef ::= id TemplateOpt TemplateOpt ::= [`extends' Template | [nl] TemplateBody] -Template ::= ConstrApps [TemplateBody] | TemplateBody Template(constr, parents, self, stats) +Template ::= ConstrApps [TemplateBody] | TemplateBody ConstrApps ::= ConstrApp {`with' ConstrApp} -ConstrApp ::= AnnotType {ArgumentExprs} Apply(tp, args) +ConstrApp ::= AnnotType {ArgumentExprs} ConstrExpr ::= SelfInvocation | ConstrBlock @@ -332,8 +332,8 @@ TopStat ::= {Annotation [nl]} {Modifier} TmplDef | Packaging | PackageObject | -Packaging ::= `package' QualId [nl] `{' TopStatSeq `}' Package(qid, stats) -PackageObject ::= `package' `object' ObjectDef object with package in mods. +Packaging ::= `package' QualId [nl] `{' TopStatSeq `}' +PackageObject ::= `package' `object' ObjectDef -CompilationUnit ::= {`package' QualId semi} TopStatSeq Package(qid, stats) +CompilationUnit ::= {`package' QualId semi} TopStatSeq ``` -- cgit v1.2.3