public ConstantFieldDeclarationNode(Token token,
                                     ParseNodeList attributes,
                                     Modifiers modifiers,
                                     ParseNode type,
                                     ParseNodeList initializers)
     : base(ParseNodeType.ConstFieldDeclaration, token, attributes, modifiers, type, initializers, false) {
 }
示例#2
0
 public UsingNode(Token token,
                  ParseNode guard,
                  ParseNode body)
     : base(ParseNodeType.Using, token) {
     _guard = GetParentedNode(guard);
     _body = GetParentedNode(body);
 }
 public DestructorDeclarationNode(Token token,
                                  ParseNodeList attributes,
                                  Modifiers modifiers,
                                  AtomicNameNode name,
                                  BlockStatementNode body)
     : base(ParseNodeType.DestructorDeclaration, token, attributes, modifiers, /* return type */ null, name, new ParseNodeList(), body) {
 }
示例#4
0
 public AttributeBlockNode(Token token,
                           AttributeTargets location,
                           ParseNodeList attributes)
     : base(ParseNodeType.AttributeBlock, token) {
     _location = location;
     _attributes = GetParentedNodeList(attributes);
 }
示例#5
0
 private void ReportError(Error error, Token token, params object[] args) {
     BufferPosition newPosition = token.Position;
     if (OnError != null && lastErrorPosition != newPosition) {
         OnError(this, new ErrorEventArgs(error, newPosition, args));
     }
     lastErrorPosition = newPosition;
 }
示例#6
0
 public SwitchSectionNode(Token token,
                          ParseNodeList labels,
                          ParseNodeList statements)
     : base(ParseNodeType.SwitchSection, token) {
     _labels = GetParentedNodeList(labels);
     _statements = GetParentedNodeList(statements);
 }
示例#7
0
 public SwitchNode(Token token,
                   ParseNode condition,
                   ParseNodeList cases)
     : base(ParseNodeType.Switch, token) {
     _condition = GetParentedNode(condition);
     _cases = GetParentedNodeList(cases);
 }
示例#8
0
 public LockNode(Token token,
                 ParseNode monitor,
                 ParseNode body)
     : base(ParseNodeType.Lock, token) {
     this.monitor = GetParentedNode(monitor);
     this.body = GetParentedNode(body);
 }
示例#9
0
 public FixedNode(Token token,
                  VariableDeclarationNode declaration,
                  ParseNode body)
     : base(ParseNodeType.Fixed, token) {
     _declaration = (VariableDeclarationNode)GetParentedNode(declaration);
     _body = GetParentedNode(body);
 }
示例#10
0
        /// <summary>
        /// Preprocesses, Lexes and Parses a C# compilation unit. Subscribe to the OnError
        /// event before calling this method to receive error notifications.
        /// After calling Parse, the Defines property contains the list of preprocessor
        /// symbols defined as a result of #define and #undef directives in this
        /// compilation unit.
        /// </summary>
        public CompilationUnitNode Parse(Token[] tokens, LineMap lineMap) {
            _lineMap = lineMap;
            CompilationUnitNode parseTree = _parser.Parse(tokens);
            _lineMap = null;

            return parseTree;
        }
示例#11
0
 public DoWhileNode(Token token,
               ParseNode body,
               ParseNode condition)
     : base(ParseNodeType.DoWhile, token) {
     _body = GetParentedNode(body);
     _condition = GetParentedNode(condition);
 }
 public VariableDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                ParseNodeList initializers,
                                bool isFixed)
     : this(ParseNodeType.VariableDeclaration, token, attributes, modifiers, type, initializers, isFixed) {
 }
示例#13
0
        /// <summary>
        /// Parses an array of C# tokens. Subscribe to the OnError event before
        /// calling Parse to receive errors while Parsing.
        /// </summary>
        public CompilationUnitNode Parse(Token[] tokens) {
            this.tokens = tokens;

            iToken = 0;
            lastErrorPosition.Column = -1;

            return ParseCompilationUnit();
        }
示例#14
0
 public CatchNode(Token token, ParseNode type,
                  AtomicNameNode name,
                  ParseNode body)
     : base(ParseNodeType.Catch, token) {
     _type = GetParentedNode(type);
     _name = (AtomicNameNode)GetParentedNode(name);
     _body = GetParentedNode(body);
 }
示例#15
0
 public NamespaceNode(Token token, string name,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token) {
     _name = name;
     _usingClauses = GetParentedNodeList(usingClauses);
     _members = GetParentedNodeList(members);
 }
示例#16
0
 public ArrayNewNode(Token token,
                     ParseNode typeReference,
                     ParseNode expressionList,
                     ParseNode initializerExpression)
     : base(ParseNodeType.ArrayNew, token) {
     _typeReference = GetParentedNode(typeReference);
     _expressionList = GetParentedNode(expressionList);
     _initializerExpression = GetParentedNode(initializerExpression);
 }
示例#17
0
 public IfElseNode(Token token,
               ParseNode condition,
               ParseNode ifBlock,
               ParseNode elseBlock)
     : base(ParseNodeType.IfElse, token) {
     _condition = GetParentedNode(condition);
     _ifBlock = GetParentedNode(ifBlock);
     _elseBlock = GetParentedNode(elseBlock);
 }
示例#18
0
 public TryNode(Token token,
                ParseNode body,
                ParseNodeList catchClauses,
                ParseNode finallyClause)
     : base(ParseNodeType.Try, token) {
     _body = GetParentedNode(body);
     _catchClauses = GetParentedNodeList(catchClauses);
     _finallyClause = GetParentedNode(finallyClause);
 }
 public OperatorDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                TokenType operatorNodeType,
                                ParseNode returnType,
                                ParseNodeList formals,
                                BlockStatementNode body)
     : base(ParseNodeType.OperatorDeclaration, token, attributes, modifiers, returnType, /* name */ null, formals, body) {
     this.operatorTokenType = operatorNodeType;
 }
示例#20
0
 public NamespaceNode(Token token, NameNode nameNode,
                      ParseNodeList externAliases,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token) {
     _name = nameNode.Name;
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses = GetParentedNodeList(usingClauses);
     _members = GetParentedNodeList(members);
 }
示例#21
0
 public ForNode(Token token,
                ParseNode initializer,
                ParseNode condition,
                ParseNode increment,
                ParseNode body)
     : base(ParseNodeType.For, token) {
     _initializer = GetParentedNode(initializer);
     _condition = GetParentedNode(condition);
     _increment = GetParentedNode(increment);
     _body = GetParentedNode(body);
 }
示例#22
0
 public ParameterNode(Token token,
                            ParseNodeList attributes,
                            ParameterFlags flags,
                            ParseNode type,
                            AtomicNameNode name)
     : base(ParseNodeType.FormalParameter, token) {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _flags = flags;
     _type = GetParentedNode(type);
     _name = (AtomicNameNode)GetParentedNode(name);
 }
示例#23
0
 public CompilationUnitNode(Token token,
                            ParseNodeList externAliases,
                            ParseNodeList usingClauses,
                            ParseNodeList attributes,
                            ParseNodeList members)
     : base(ParseNodeType.CompilationUnit, token) {
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses = GetParentedNodeList(usingClauses);
     _attributes = GetParentedNodeList(attributes);
     _members = GetParentedNodeList(GetNamespaces(members));
 }
 public PropertyDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                NameNode interfaceType,
                                AtomicNameNode name,
                                AccessorNode getOrRemove,
                                AccessorNode setOrAdd)
     : this(ParseNodeType.PropertyDeclaration, token, attributes, modifiers, type, interfaceType, getOrRemove, setOrAdd) {
     _name = (AtomicNameNode)GetParentedNode(name);
 }
示例#25
0
 public ForeachNode(Token token,
                    ParseNode type,
                    AtomicNameNode name,
                    ParseNode container,
                    ParseNode body)
     : base(ParseNodeType.Foreach, token) {
     _type = GetParentedNode(type);
     _name = (AtomicNameNode)GetParentedNode(name);
     _container = GetParentedNode(container);
     _body = GetParentedNode(body);
 }
示例#26
0
 public AccessorNode(Token token,
                     ParseNodeList attributes,
                     AtomicNameNode name,
                     BlockStatementNode body,
                     Modifiers modifiers)
     : base(ParseNodeType.AccessorDeclaration, token) {
     _name = (AtomicNameNode)GetParentedNode(name);
     _implementation = (BlockStatementNode)GetParentedNode(body);
     _attributes = GetParentedNodeList(attributes);
     _modifiers = modifiers;
 }
 public IndexerDeclarationNode(Token token,
                               ParseNodeList attributes,
                               Modifiers modifiers,
                               ParseNode type,
                               NameNode interfaceType,
                               ParseNodeList parameters,
                               AccessorNode get,
                               AccessorNode set)
     : base(ParseNodeType.IndexerDeclaration, token, attributes, modifiers, type, interfaceType, get, set)
 {
     _parameters = GetParentedNodeList(parameters);
 }
 public ConstructorDeclarationNode(Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   AtomicNameNode name,
                                   ParseNodeList formals,
                                   bool callBase,
                                   ParseNode baseArguments,
                                   BlockStatementNode body)
     : base(ParseNodeType.ConstructorDeclaration, token, attributes, modifiers, /* return type */ null, name, formals, body) {
     _callBase = callBase;
     _baseArguments = GetParentedNode(baseArguments);
 }
示例#29
0
 public DelegateTypeNode(Token token,
                         ParseNodeList attributes,
                         Modifiers modifiers,
                         ParseNode returnType,
                         AtomicNameNode name,
                         ParseNodeList typeParameters,
                         ParseNodeList parameters,
                         ParseNodeList constraintClauses)
     : base(ParseNodeType.Delegate, token, TokenType.Delegate, attributes, modifiers, name, typeParameters, constraintClauses) {
     _returnType = GetParentedNode(returnType);
     _parameters = GetParentedNodeList(parameters);
 }
示例#30
0
 public CustomTypeNode(Token token, TokenType type,
                       ParseNodeList attributes,
                       Modifiers modifiers,
                       AtomicNameNode name,
                       ParseNodeList typeParameters,
                       ParseNodeList baseTypes,
                       ParseNodeList constraintClauses,
                       ParseNodeList members)
     : base(ParseNodeType.Type, token, type, attributes, modifiers, name, typeParameters, constraintClauses) {
     _baseTypes = GetParentedNodeList(baseTypes);
     _members = GetParentedNodeList(members);
 }