public InstanceFunctionCallSyntax(SyntaxBase baseExpression, Token dot, IdentifierSyntax name, Token openParen, IEnumerable <SyntaxBase> children, Token closeParen)
            : base(name, openParen, children, closeParen)
        {
            AssertTokenType(dot, nameof(dot), TokenType.Dot);

            this.BaseExpression = baseExpression;
            this.Dot            = dot;
        }
Example #2
0
        public ResourceAccessSyntax(SyntaxBase baseExpression, Token doubleColon, IdentifierSyntax resourceName)
        {
            AssertTokenType(doubleColon, nameof(doubleColon), TokenType.DoubleColon);

            this.BaseExpression = baseExpression;
            this.DoubleColon    = doubleColon;
            this.ResourceName   = resourceName;
        }
Example #3
0
        public PropertyAccessSyntax(SyntaxBase baseExpression, Token dot, IdentifierSyntax propertyName)
        {
            AssertTokenType(dot, nameof(dot), TokenType.Dot);

            this.BaseExpression = baseExpression;
            this.Dot            = dot;
            this.PropertyName   = propertyName;
        }
Example #4
0
        public ParameterDeclarationSyntax(Token parameterKeyword, IdentifierSyntax name, TypeSyntax type, SyntaxBase?modifier)
        {
            AssertKeyword(parameterKeyword, nameof(parameterKeyword), LanguageConstants.ParameterKeyword);
            AssertSyntaxType(modifier, nameof(modifier), typeof(ParameterDefaultValueSyntax), typeof(ObjectSyntax));

            this.ParameterKeyword = parameterKeyword;
            this.Name             = name;
            this.Type             = type;
            this.Modifier         = modifier;
        }
Example #5
0
        public FunctionCallSyntax(IdentifierSyntax name, Token openParen, IEnumerable <FunctionArgumentSyntax> arguments, Token closeParen)
        {
            AssertTokenType(openParen, nameof(openParen), TokenType.LeftParen);
            AssertTokenType(closeParen, nameof(closeParen), TokenType.RightParen);

            this.Name       = name;
            this.OpenParen  = openParen;
            this.Arguments  = arguments.ToImmutableArray();
            this.CloseParen = closeParen;
        }
Example #6
0
        public VariableDeclarationSyntax(Token variableKeyword, IdentifierSyntax name, Token assignment, SyntaxBase value)
        {
            AssertKeyword(variableKeyword, nameof(variableKeyword), LanguageConstants.VariableKeyword);
            AssertTokenType(assignment, nameof(assignment), TokenType.Assignment);

            this.VariableKeyword = variableKeyword;
            this.Name            = name;
            this.Assignment      = assignment;
            this.Value           = value;
        }
Example #7
0
        protected FunctionCallSyntaxBase(IdentifierSyntax name, Token openParen, IEnumerable <SyntaxBase> children, Token closeParen)
        {
            AssertTokenType(openParen, nameof(openParen), TokenType.LeftParen);
            AssertTokenType(closeParen, nameof(closeParen), TokenType.RightParen);

            this.Name       = name;
            this.OpenParen  = openParen;
            this.Children   = children.ToImmutableArray();
            this.CloseParen = closeParen;
        }
Example #8
0
        public OutputDeclarationSyntax(Token outputKeyword, IdentifierSyntax name, TypeSyntax type, Token assignment, SyntaxBase value)
        {
            AssertKeyword(outputKeyword, nameof(outputKeyword), LanguageConstants.OutputKeyword);
            AssertTokenType(assignment, nameof(assignment), TokenType.Assignment);

            this.OutputKeyword = outputKeyword;
            this.Name          = name;
            this.Type          = type;
            this.Assignment    = assignment;
            this.Value         = value;
        }
Example #9
0
        protected virtual SyntaxBase ReplaceIdentifierSyntax(IdentifierSyntax syntax)
        {
            var hasChanges = TryRewrite(syntax.Child, out var child);

            if (!hasChanges)
            {
                return(syntax);
            }

            return(new IdentifierSyntax(child));
        }
        public ParameterDeclarationSyntax(Token keyword, IdentifierSyntax name, SyntaxBase type, SyntaxBase?modifier)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ParameterKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(type, nameof(type), typeof(TypeSyntax), typeof(SkippedTriviaSyntax));
            AssertSyntaxType(modifier, nameof(modifier), typeof(ParameterDefaultValueSyntax), typeof(ObjectSyntax), typeof(SkippedTriviaSyntax));

            this.Keyword  = keyword;
            this.Name     = name;
            this.Type     = type;
            this.Modifier = modifier;
        }
Example #11
0
        public VariableDeclarationSyntax(Token keyword, IdentifierSyntax name, SyntaxBase assignment, SyntaxBase value)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.VariableKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);

            this.Keyword    = keyword;
            this.Name       = name;
            this.Assignment = assignment;
            this.Value      = value;
        }
Example #12
0
        public ResourceDeclarationSyntax(Token resourceKeyword, IdentifierSyntax name, SyntaxBase type, Token assignment, SyntaxBase body)
        {
            AssertKeyword(resourceKeyword, nameof(resourceKeyword), LanguageConstants.ResourceKeyword);
            AssertTokenType(resourceKeyword, nameof(resourceKeyword), TokenType.Identifier);
            AssertTokenType(assignment, nameof(assignment), TokenType.Assignment);

            this.ResourceKeyword = resourceKeyword;
            this.Name            = name;
            this.Type            = type;
            this.Assignment      = assignment;
            this.Body            = body;
        }
        public InstanceFunctionCallSyntax(SyntaxBase baseExpression, Token dot, IdentifierSyntax name, Token openParen, IEnumerable <FunctionArgumentSyntax> arguments, Token closeParen)
        {
            AssertTokenType(openParen, nameof(openParen), TokenType.LeftParen);
            AssertTokenType(closeParen, nameof(closeParen), TokenType.RightParen);
            AssertTokenType(dot, nameof(dot), TokenType.Dot);

            this.BaseExpression = baseExpression;
            this.Dot            = dot;
            this.Name           = name;
            this.OpenParen      = openParen;
            this.Arguments      = arguments.ToImmutableArray();
            this.CloseParen     = closeParen;
        }
Example #14
0
        public ResourceDeclarationSyntax(Token keyword, IdentifierSyntax name, SyntaxBase type, SyntaxBase assignment, SyntaxBase body)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ResourceKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(type, nameof(type), typeof(StringSyntax), typeof(SkippedTriviaSyntax));
            AssertTokenType(keyword, nameof(keyword), TokenType.Identifier);
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);

            this.Keyword    = keyword;
            this.Name       = name;
            this.Type       = type;
            this.Assignment = assignment;
            this.Body       = body;
        }
Example #15
0
        public ModuleDeclarationSyntax(Token keyword, IdentifierSyntax name, SyntaxBase path, SyntaxBase assignment, SyntaxBase body)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ModuleKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(path, nameof(path), typeof(StringSyntax), typeof(SkippedTriviaSyntax));
            AssertTokenType(keyword, nameof(keyword), TokenType.Identifier);
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);
            AssertSyntaxType(body, nameof(body), typeof(SkippedTriviaSyntax), typeof(ObjectSyntax));

            this.Keyword    = keyword;
            this.Name       = name;
            this.Path       = path;
            this.Assignment = assignment;
            this.Body       = body;
        }
 public FunctionCallSyntax(IdentifierSyntax name, Token openParen, IEnumerable <FunctionArgumentSyntax> arguments, Token closeParen)
     : base(name, openParen, arguments, closeParen)
 {
 }
        public ModuleDeclarationSyntax(IEnumerable <SyntaxBase> leadingNodes, Token keyword, IdentifierSyntax name, SyntaxBase path, SyntaxBase assignment, SyntaxBase value)
            : base(leadingNodes)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ModuleKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(path, nameof(path), typeof(StringSyntax), typeof(SkippedTriviaSyntax));
            AssertTokenType(keyword, nameof(keyword), TokenType.Identifier);
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);
            AssertSyntaxType(value, nameof(value), typeof(SkippedTriviaSyntax), typeof(ObjectSyntax), typeof(IfConditionSyntax), typeof(ForSyntax));

            this.Keyword    = keyword;
            this.Name       = name;
            this.Path       = path;
            this.Assignment = assignment;
            this.Value      = value;
        }
Example #18
0
 public virtual void VisitIdentifierSyntax(IdentifierSyntax syntax)
 {
     this.Visit(syntax.Child);
 }
Example #19
0
 public FunctionCallSyntax(IdentifierSyntax name, Token openParen, IEnumerable <SyntaxBase> children, Token closeParen)
     : base(name, openParen, children, closeParen)
 {
 }
Example #20
0
 public VariableAccessSyntax(IdentifierSyntax name)
 {
     this.Name = name;
 }
Example #21
0
 public static bool NameEquals(this IdentifierSyntax identifier, string compareTo)
 => LanguageConstants.IdentifierComparer.Equals(identifier.IdentifierName, compareTo);
        public ImportDeclarationSyntax(IEnumerable <SyntaxBase> leadingNodes, Token keyword, IdentifierSyntax providerName, SyntaxBase asKeyword, IdentifierSyntax aliasName, SyntaxBase?config)
            : base(leadingNodes)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ImportKeyword);
            AssertSyntaxType(providerName, nameof(providerName), typeof(IdentifierSyntax));
            AssertSyntaxType(asKeyword, nameof(asKeyword), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertSyntaxType(aliasName, nameof(aliasName), typeof(IdentifierSyntax));
            AssertSyntaxType(config, nameof(config), typeof(ObjectSyntax), typeof(SkippedTriviaSyntax));

            this.Keyword      = keyword;
            this.ProviderName = providerName;
            this.AsKeyword    = asKeyword;
            this.AliasName    = aliasName;
            this.Config       = config;
        }
Example #23
0
        public OutputDeclarationSyntax(IEnumerable <SyntaxBase> leadingNodes, Token keyword, IdentifierSyntax name, SyntaxBase type, SyntaxBase assignment, SyntaxBase value)
            : base(leadingNodes)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.OutputKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax), typeof(IdentifierSyntax));
            AssertSyntaxType(type, nameof(type), typeof(SimpleTypeSyntax), typeof(ResourceTypeSyntax), typeof(SkippedTriviaSyntax));
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);

            this.Keyword    = keyword;
            this.Name       = name;
            this.Type       = type;
            this.Assignment = assignment;
            this.Value      = value;
        }
Example #24
0
 public LocalVariableSyntax(IdentifierSyntax name)
 {
     this.Name = name;
 }
Example #25
0
        public ResourceDeclarationSyntax(IEnumerable <SyntaxBase> leadingNodes, Token keyword, IdentifierSyntax name, SyntaxBase type, Token?existingKeyword, SyntaxBase assignment, SyntaxBase value)
            : base(leadingNodes)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ResourceKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(type, nameof(type), typeof(StringSyntax), typeof(SkippedTriviaSyntax));
            AssertKeyword(existingKeyword, nameof(existingKeyword), LanguageConstants.ExistingKeyword);
            AssertTokenType(keyword, nameof(keyword), TokenType.Identifier);
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);
            AssertSyntaxType(value, nameof(value), typeof(SkippedTriviaSyntax), typeof(ObjectSyntax), typeof(IfConditionSyntax), typeof(ForSyntax));

            this.Keyword         = keyword;
            this.Name            = name;
            this.Type            = type;
            this.ExistingKeyword = existingKeyword;
            this.Assignment      = assignment;
            this.Value           = value;
        }
Example #26
0
 public virtual void VisitIdentifierSyntax(IdentifierSyntax syntax)
 {
     this.VisitToken(syntax.Identifier);
 }
        public ResourceDeclarationSyntax(IEnumerable <SyntaxBase> leadingNodes, Token keyword, IdentifierSyntax name, SyntaxBase type, SyntaxBase assignment, SyntaxBase?ifCondition, SyntaxBase body)
            : base(leadingNodes)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ResourceKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(type, nameof(type), typeof(StringSyntax), typeof(SkippedTriviaSyntax));
            AssertTokenType(keyword, nameof(keyword), TokenType.Identifier);
            AssertSyntaxType(assignment, nameof(assignment), typeof(Token), typeof(SkippedTriviaSyntax));
            AssertTokenType(assignment as Token, nameof(assignment), TokenType.Assignment);
            AssertSyntaxType(ifCondition, nameof(ifCondition), typeof(SkippedTriviaSyntax), typeof(IfConditionSyntax));
            AssertSyntaxType(body, nameof(body), typeof(SkippedTriviaSyntax), typeof(ObjectSyntax));

            this.Keyword     = keyword;
            this.Name        = name;
            this.Type        = type;
            this.Assignment  = assignment;
            this.IfCondition = ifCondition;
            this.Body        = body;
        }
Example #28
0
 void ISyntaxVisitor.VisitIdentifierSyntax(IdentifierSyntax syntax) => ReplaceCurrent(syntax, ReplaceIdentifierSyntax);
Example #29
0
        public ParameterDeclarationSyntax(IEnumerable <SyntaxBase> leadingNodes, Token keyword, IdentifierSyntax name, SyntaxBase type, SyntaxBase?modifier)
            : base(leadingNodes)
        {
            AssertKeyword(keyword, nameof(keyword), LanguageConstants.ParameterKeyword);
            AssertSyntaxType(name, nameof(name), typeof(IdentifierSyntax));
            AssertSyntaxType(type, nameof(type), typeof(SimpleTypeSyntax), typeof(ResourceTypeSyntax), typeof(SkippedTriviaSyntax));
            AssertSyntaxType(modifier, nameof(modifier), typeof(ParameterDefaultValueSyntax), typeof(SkippedTriviaSyntax));

            this.Keyword  = keyword;
            this.Name     = name;
            this.Type     = type;
            this.Modifier = modifier;
        }