Ejemplo n.º 1
0
 protected override Nfa BuildFunctionLitRule()
 {
     // inline the body rule
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.FunctionType),
                Nfa.Rule(Bindings.Block)));
 }
 protected virtual Nfa BuildLetDeclRule()
 {
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.NameDefinition),
                Nfa.Match(AlloyLexer.EQ),
                Nfa.Rule(Bindings.Expr)));
 }
 protected virtual Nfa BuildEnumBodyRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(AlloyLexer.LBRACE),
                Nfa.Rule(Bindings.NameList),
                Nfa.Match(AlloyLexer.RBRACE)));
 }
Ejemplo n.º 4
0
 protected override Nfa BuildLabeledStmtRule()
 {
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.SymbolDefinitionIdentifier),
                Nfa.Match(GoLexer.COLON),
                Nfa.Rule(Bindings.Statement)));
 }
Ejemplo n.º 5
0
 protected override Nfa BuildPointerTypeRule()
 {
     // inline the baseType rule
     return(Nfa.Sequence(
                Nfa.Match(GoLexer.TIMES),
                Nfa.Rule(Bindings.Type)));
 }
 protected virtual Nfa BuildBlockRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(AlloyLexer.LBRACE),
                Nfa.Closure(Nfa.Rule(Bindings.Expr)),
                Nfa.Match(AlloyLexer.RBRACE)));
 }
Ejemplo n.º 7
0
 protected override Nfa BuildSliceTypeRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(GoLexer.LBRACK),
                Nfa.Match(GoLexer.RBRACK),
                Nfa.Rule(Bindings.Type)));
 }
Ejemplo n.º 8
0
 protected override Nfa BuildMethodDeclRule()
 {
     // inline the body rule
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.MethodDeclHeader),
                Nfa.Optional(Nfa.Rule(Bindings.Block))));
 }
 protected virtual Nfa BuildEnumDeclRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(AlloyLexer.KW_ENUM),
                Nfa.Rule(Bindings.NameDefinition),
                Nfa.Rule(Bindings.EnumBody)));
 }
 protected virtual Nfa BuildSpecificationRule()
 {
     return(Nfa.Sequence(
                Nfa.Optional(Nfa.Rule(Bindings.Module)),
                Nfa.Closure(Nfa.Rule(Bindings.Open)),
                Nfa.Closure(Nfa.Rule(Bindings.Paragraph))));
 }
 protected virtual Nfa BuildSigDeclHeaderRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(AlloyLexer.KW_SIG),
                Nfa.Rule(Bindings.NameDeclList),
                Nfa.Optional(Nfa.Rule(Bindings.SigExt))));
 }
 protected virtual Nfa BuildUnOpExpr19Rule()
 {
     return(Nfa.Choice(
                Nfa.Sequence(
                    Nfa.MatchAny(AlloyLexer.TILDE, AlloyLexer.STAR, AlloyLexer.CARET),
                    Nfa.Rule(Bindings.UnOpExpr19)),
                Nfa.Rule(Bindings.PrimaryExpr)));
 }
Ejemplo n.º 13
0
 protected override Nfa BuildArrayTypeRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(GoLexer.LBRACK),
                Nfa.Rule(Bindings.Expression),
                Nfa.Match(GoLexer.RBRACK),
                Nfa.Rule(Bindings.Type)));
 }
 protected virtual Nfa BuildSigDeclRule()
 {
     return(Nfa.Sequence(
                Nfa.Closure(Nfa.Rule(Bindings.SigQual)),
                Nfa.Rule(Bindings.SigDeclHeader),
                Nfa.Rule(Bindings.SigBody),
                Nfa.Optional(Nfa.Rule(Bindings.Block))));
 }
Ejemplo n.º 15
0
 protected override Nfa BuildMethodSpecRule()
 {
     return(Nfa.Choice(
                Nfa.Sequence(
                    Nfa.Rule(Bindings.MethodName),
                    Nfa.Rule(Bindings.Signature)),
                Nfa.Rule(Bindings.QualifiedIdent)));
 }
Ejemplo n.º 16
0
 protected override Nfa BuildSimpleStmtRule()
 {
     return(Nfa.Choice(
                Nfa.Rule(Bindings.ShortVarDecl),
                Nfa.Rule(Bindings.Assignment),
                Nfa.Rule(Bindings.IncDecStmt),
                Nfa.Rule(Bindings.Expression),
                Nfa.Rule(Bindings.EmptyStmt)));
 }
 protected virtual Nfa BuildFunctionNameRule()
 {
     return(Nfa.Sequence(
                Nfa.Optional(
                    Nfa.Sequence(
                        Nfa.Rule(Bindings.Ref),
                        Nfa.Match(AlloyLexer.DOT))),
                Nfa.Rule(Bindings.NameDefinition)));
 }
Ejemplo n.º 18
0
 protected override Nfa BuildElementRule()
 {
     return(Nfa.Sequence(
                Nfa.Optional(
                    Nfa.Sequence(
                        Nfa.Rule(Bindings.Expression),
                        Nfa.Match(GoLexer.COLON))),
                Nfa.Rule(Bindings.Value)));
 }
Ejemplo n.º 19
0
 protected override Nfa BuildForClauseRule()
 {
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.SimpleStmt),
                Nfa.Match(GoLexer.SEMI),
                Nfa.Optional(Nfa.Rule(Bindings.Expression)),
                Nfa.Match(GoLexer.SEMI),
                Nfa.Rule(Bindings.SimpleStmt)));
 }
 protected virtual Nfa BuildNameReferenceRule()
 {
     return(Nfa.Sequence(
                Nfa.MatchAny(AlloyLexer.KW_THIS, AlloyLexer.IDENTIFIER),
                Nfa.Closure(
                    Nfa.Sequence(
                        Nfa.Match(AlloyLexer.SLASH),
                        Nfa.Match(AlloyLexer.IDENTIFIER)))));
 }
 protected virtual Nfa BuildParagraphRule()
 {
     return(Nfa.Choice(
                Nfa.Rule(Bindings.FactDecl),
                Nfa.Rule(Bindings.AssertDecl),
                Nfa.Rule(Bindings.FunDecl),
                Nfa.Rule(Bindings.CmdDecl),
                Nfa.Rule(Bindings.EnumDecl),
                Nfa.Rule(Bindings.SigDecl)));
 }
Ejemplo n.º 22
0
 protected override Nfa BuildTypeRule()
 {
     // factor out the typeNoParens rule
     return(Nfa.Choice(
                Nfa.Rule(Bindings.TypeNoParens),
                Nfa.Sequence(
                    Nfa.Match(GoLexer.LPAREN),
                    Nfa.Rule(Bindings.Type),
                    Nfa.Match(GoLexer.RPAREN))));
 }
Ejemplo n.º 23
0
 protected override Nfa BuildReceiverRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(GoLexer.LPAREN),
                Nfa.Optional(Nfa.Rule(Bindings.SymbolDefinitionIdentifier)),
                Nfa.Optional(Nfa.Match(GoLexer.TIMES)),
                // inline the baseTypeName rule
                Nfa.Rule(Bindings.SymbolReferenceIdentifier),
                Nfa.Match(GoLexer.RPAREN)));
 }
Ejemplo n.º 24
0
 protected override Nfa BuildReceiverTypeRule()
 {
     return(Nfa.Choice(
                Nfa.Rule(Bindings.QualifiedIdent),
                Nfa.Sequence(
                    Nfa.Match(GoLexer.LPAREN),
                    Nfa.Match(GoLexer.TIMES),
                    Nfa.Rule(Bindings.QualifiedIdent),
                    Nfa.Match(GoLexer.RPAREN))));
 }
 protected virtual Nfa BuildTypescopeDeclListRule()
 {
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.Typescope),
                Nfa.Closure(
                    Nfa.Sequence(
                        Nfa.Match(AlloyLexer.COMMA),
                        Nfa.Rule(Bindings.Typescope))),
                Nfa.Optional(Nfa.Match(AlloyLexer.COMMA))));
 }
 protected virtual Nfa BuildTypescopeRule()
 {
     return(Nfa.Sequence(
                Nfa.Optional(Nfa.Match(AlloyLexer.KW_EXACTLY)),
                Nfa.Rule(Bindings.Number),
                Nfa.Optional(
                    Nfa.Choice(
                        Nfa.Rule(Bindings.NameReference),
                        Nfa.MatchAny(AlloyLexer.KW_INT, AlloyLexer.KW_SEQ)))));
 }
 protected virtual Nfa BuildDeclRule()
 {
     return(Nfa.Sequence(
                Nfa.Optional(Nfa.Match(AlloyLexer.KW_PRIVATE)),
                Nfa.Optional(Nfa.Match(AlloyLexer.KW_DISJ)),
                Nfa.Rule(Bindings.NameList),
                Nfa.Match(AlloyLexer.COLON),
                Nfa.Optional(Nfa.Match(AlloyLexer.KW_DISJ)),
                //Nfa.Rule(Bindings.Expr));
                Nfa.Rule(Bindings.BinaryExpression)));
 }
 protected virtual Nfa BuildQuantDeclsRule()
 {
     return(Nfa.Sequence(
                Nfa.Rule(Bindings.Quant),
                Nfa.Rule(Bindings.Decl),
                Nfa.Closure(
                    Nfa.Sequence(
                        Nfa.Match(AlloyLexer.COMMA),
                        Nfa.Rule(Bindings.Decl))),
                Nfa.Optional(Nfa.Match(AlloyLexer.COMMA))));
 }
Ejemplo n.º 29
0
 protected override Nfa BuildForStmtRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(GoLexer.KW_FOR),
                Nfa.Optional(
                    Nfa.Choice(
                        Nfa.Rule(Bindings.RangeClause),
                        Nfa.Rule(Bindings.ForClause),
                        Nfa.Rule(Bindings.Expression))),
                Nfa.Rule(Bindings.Block)));
 }
 protected virtual Nfa BuildCmdScopeForRule()
 {
     return(Nfa.Sequence(
                Nfa.Match(AlloyLexer.KW_FOR),
                Nfa.Choice(
                    Nfa.Sequence(
                        Nfa.Rule(Bindings.Number),
                        Nfa.Match(AlloyLexer.KW_BUT),
                        Nfa.Rule(Bindings.TypescopeDeclList)),
                    Nfa.Rule(Bindings.TypescopeDeclList))));
 }