protected virtual Nfa BuildBlockRule() { return(Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACE), Nfa.Closure(Nfa.Rule(Bindings.Expr)), Nfa.Match(AlloyLexer.RBRACE))); }
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 BuildSigDeclRule() { return(Nfa.Sequence( Nfa.Closure(Nfa.Rule(Bindings.SigQual)), Nfa.Rule(Bindings.SigDeclHeader), Nfa.Rule(Bindings.SigBody), Nfa.Optional(Nfa.Rule(Bindings.Block)))); }
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 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 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)))); }
protected override Nfa BuildLiteralValueRule() { // brace matching only return(Nfa.Sequence( Nfa.Match(GoLexer.LBRACE), Nfa.Closure( Nfa.Choice( Nfa.MatchComplement(new Interval(GoLexer.LBRACE, 1), new Interval(GoLexer.RBRACE, 1)), Nfa.Rule(Bindings.LiteralValue))), Nfa.Match(GoLexer.RBRACE))); }
protected virtual Nfa BuildNameListRule() { return(Nfa.Sequence( Nfa.Rule(Bindings.NameListName), Nfa.Optional( Nfa.Sequence( Nfa.Match(AlloyLexer.COMMA), Nfa.Rule(Bindings.NameListName), Nfa.Closure( Nfa.Sequence( Nfa.Match(AlloyLexer.COMMA), Nfa.Rule(Bindings.NameListName))))))); }
protected override Nfa BuildSigBodyRule() { /* For outlining, this matches braces and ensures the seek doesn't run * into a keyword that can't be contained in the block. */ return(Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACE), Nfa.Closure( Nfa.Choice( Nfa.MatchComplement(BracesAndKeywords), Nfa.Rule(Bindings.SigBody))), Nfa.Match(AlloyLexer.RBRACE))); }
protected override Nfa BuildReceiverRule() { /* For outlining, this matches braces and ensures the seek doesn't run * into a keyword that can't be contained in the block. */ return(Nfa.Sequence( Nfa.Match(GoLexer.LPAREN), Nfa.Closure( Nfa.Choice( Nfa.MatchComplement(new Interval(GoLexer.LPAREN, 1), new Interval(GoLexer.RPAREN, 1)), Nfa.Rule(Bindings.Receiver))), Nfa.Match(GoLexer.RPAREN))); }
protected virtual Nfa BuildSigExtRule() { return(Nfa.Choice( Nfa.Sequence( Nfa.Match(AlloyLexer.KW_EXTENDS), Nfa.Rule(Bindings.Ref)), Nfa.Sequence( Nfa.Match(AlloyLexer.KW_IN), Nfa.Rule(Bindings.Ref), Nfa.Closure( Nfa.Sequence( Nfa.Match(AlloyLexer.PLUS), Nfa.Rule(Bindings.Ref)))))); }
protected virtual Nfa BuildBinOpExpr18Rule() { return(Nfa.Sequence( Nfa.Rule(Bindings.UnOpExpr19), Nfa.Closure( Nfa.Choice( Nfa.Sequence( Nfa.Match(AlloyLexer.DOT), Nfa.Rule(Bindings.UnOpExpr19)), Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACK), Nfa.Rule(Bindings.CallArguments), Nfa.Match(AlloyLexer.RBRACK)))))); }
protected virtual Nfa BuildUnaryExpression() { int[] unaryPrefixOperators = { AlloyLexer.NOT, AlloyLexer.KW_NOT, AlloyLexer.KW_NO, AlloyLexer.KW_SOME,AlloyLexer.KW_LONE, AlloyLexer.KW_ONE, AlloyLexer.KW_SET, AlloyLexer.KW_SEQ, AlloyLexer.COUNT }; int[] unarySuffixOperators = { }; return(Nfa.Sequence( Nfa.Closure(Nfa.MatchAny(unaryPrefixOperators)), Nfa.Rule(Bindings.BinOpExpr18))); }
protected virtual Nfa BuildSigBodyRule() { return(Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACE), Nfa.Optional( Nfa.Sequence( Nfa.Rule(Bindings.Decl), Nfa.Closure( Nfa.Sequence( Nfa.Match(AlloyLexer.COMMA), Nfa.Rule(Bindings.Decl))), Nfa.Optional(Nfa.Match(AlloyLexer.COMMA)))), Nfa.Match(AlloyLexer.RBRACE))); }
protected virtual Nfa BuildModuleRule() { return(Nfa.Sequence( Nfa.Match(AlloyLexer.KW_MODULE), Nfa.Rule(Bindings.NameDefinition), Nfa.Optional( Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACK), Nfa.Optional(Nfa.Match(AlloyLexer.KW_EXACTLY)), Nfa.Rule(Bindings.Name), Nfa.Closure( Nfa.Sequence( Nfa.Match(AlloyLexer.COMMA), Nfa.Optional(Nfa.Match(AlloyLexer.KW_EXACTLY)), Nfa.Rule(Bindings.Number))), Nfa.Match(AlloyLexer.RBRACK))))); }
protected virtual Nfa BuildBinaryExpression() { int[] binaryOperators = { AlloyLexer.OR, AlloyLexer.KW_OR, AlloyLexer.IFF, AlloyLexer.KW_IFF, AlloyLexer.AND, AlloyLexer.KW_AND, AlloyLexer.LSHIFT, AlloyLexer.RSHIFT,AlloyLexer.URSHIFT, AlloyLexer.PLUS, AlloyLexer.MINUS, AlloyLexer.OVERRIDE, AlloyLexer.BITAND, AlloyLexer.DOMAIN_RES, AlloyLexer.RANGE_RES, }; int[] binaryComparisonOperators = { AlloyLexer.LT, AlloyLexer.GT, AlloyLexer.LE, AlloyLexer.GE, AlloyLexer.EQ, AlloyLexer.KW_IN }; return(Nfa.Sequence( Nfa.Rule(Bindings.UnaryExpression), Nfa.Closure( Nfa.Choice( Nfa.Sequence( Nfa.MatchAny(binaryOperators), Nfa.Rule(Bindings.UnaryExpression)), Nfa.Sequence( Nfa.Optional(Nfa.Rule(Bindings.ArrowMultiplicity)), Nfa.Match(AlloyLexer.ARROW), Nfa.Optional(Nfa.Rule(Bindings.ArrowMultiplicity)), Nfa.Rule(Bindings.UnaryExpression)), Nfa.Sequence( Nfa.Optional(Nfa.MatchAny(AlloyLexer.NOT, AlloyLexer.KW_NOT)), Nfa.MatchAny(binaryComparisonOperators), Nfa.Rule(Bindings.UnaryExpression)), Nfa.Sequence( Nfa.MatchAny(AlloyLexer.IMPLIES, AlloyLexer.KW_IMPLIES), Nfa.Rule(Bindings.BinaryExpression), Nfa.Optional(Nfa.Rule(Bindings.ElseClause))))))); }
protected virtual Nfa BuildCallArguments() { #if false return(Nfa.Closure( Nfa.Choice( Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACK), Nfa.Rule(Rules.CallArguments), Nfa.Match(AlloyLexer.RBRACK)), Nfa.MatchComplement(Interval.FromBounds(AlloyLexer.LBRACK, AlloyLexer.LBRACK), Interval.FromBounds(AlloyLexer.RBRACK, AlloyLexer.RBRACK))))); #else return(Nfa.Optional( Nfa.Sequence( Nfa.Rule(Bindings.Expr), Nfa.Closure( Nfa.Sequence( Nfa.Match(AlloyLexer.COMMA), Nfa.Rule(Bindings.Expr)))))); #endif }
protected virtual Nfa BuildOpenRule() { return(Nfa.Sequence( Nfa.Optional(Nfa.Match(AlloyLexer.KW_PRIVATE)), Nfa.Match(AlloyLexer.KW_OPEN), Nfa.Rule(Bindings.NameReference), Nfa.Optional( Nfa.Sequence( Nfa.Match(AlloyLexer.LBRACK), Nfa.Rule(Bindings.Ref), Nfa.Closure( Nfa.Sequence( Nfa.Match(AlloyLexer.COMMA), Nfa.Rule(Bindings.Ref))), Nfa.Optional(Nfa.Match(AlloyLexer.COMMA)), Nfa.Match(AlloyLexer.RBRACK))), Nfa.Optional( Nfa.Sequence( Nfa.Match(AlloyLexer.KW_AS), Nfa.Rule(Bindings.NameDefinition))))); }