Пример #1
0
 public virtual Statement VisitExpose(Expose @expose)
 {
     if (@expose == null) return null;
     @expose.Instance = this.VisitExpression(@expose.Instance);
     @expose.Body = this.VisitBlock(expose.Body);
     return expose;
 }
Пример #2
0
    private Statement ParseExpose(TokenSet followers, NodeType nodeType, bool preferExpressionToDeclaration){
      Token tok = this.currentToken;
      int tokStartPos = this.scanner.CurrentSourceContext.StartPos;
      ScannerState ss = this.scanner.state;
      Expose expose = new Expose(nodeType);
      if (tok == Token.Expose) expose.IsLocal = true;
      expose.SourceContext = this.scanner.CurrentSourceContext;
      this.GetNextToken();
      if (tok == Token.Read || tok == Token.Write) {
        if (this.currentToken != Token.Lock) goto AbandonExpose;
        this.GetNextToken();
      } else if (tok == Token.Additive) {
        if (this.currentToken != Token.Expose) goto AbandonExpose;
        this.GetNextToken();
      } else if (this.currentToken != Token.LeftParenthesis)
        goto AbandonExpose;
      SourceContext sctx = this.scanner.CurrentSourceContext;
      this.Skip(Token.LeftParenthesis);
      expose.Instance = this.ParseExpression(followers | Token.RightParenthesis | Parser.StatementStart);
      this.ParseBracket(sctx, Token.RightParenthesis, followers|Parser.StatementStart, Error.ExpectedRightParenthesis);

      Block b = this.ParseStatementAsBlock(followers);
      expose.Body = b;
      if (b != null){
        expose.SourceContext.EndPos = b.SourceContext.EndPos;
        if (b.Statements == null)
          this.HandleError(b.SourceContext, Error.PossibleMistakenNullStatement);
      }
      return expose;
    AbandonExpose:
      this.scanner.endPos = tokStartPos;
      this.scanner.state = ss;
      this.currentToken = Token.None;
      this.GetNextToken();
      return this.ParseExpressionStatementOrDeclaration(false, followers, preferExpressionToDeclaration, true);
    }
Пример #3
0
 public override Statement VisitExpose(Expose Expose)
 {
     if (Expose == null) return null;
     return base.VisitExpose((Expose)Expose.Clone());
 }
Пример #4
0
 public EventingVisitor(Action<Expose> visitExpose) { VisitedExpose += visitExpose; } public event Action<Expose> VisitedExpose; public override Statement VisitExpose(Expose expose) { if (VisitedExpose != null) VisitedExpose(expose); return base.VisitExpose(expose); }