Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-46

Parser to support method declarations in scripts

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-3
    • parser
    • None

    Description

      When creating scripts, it'd be cool to be able to create methods in the script. e.g.

      foo {
      println
      }

      [1, 2, 3].each

      { foo(it) }

      This kinda thing might impact the parser implementation somewhat. The AST can handle the above right now - we just need the parser to handle it. e.g. in ASTBuilder the datatypeDeclaration() method currently checks for class, interface or statement.

      Making it detect a method declaration and calling module.addMethod(MethodNode) would fix this.

      Though I'm leaving it up to you if this is gonna be easy & possible

      Attachments

        Activity

          People

            Unassigned Unassigned
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: