Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue 52: Annotations and Macros #101

Open
consiliens opened this Issue · 1 comment

2 participants

@consiliens

"
Reported by Smokejum...@gmail.com, Apr 20, 2011
https://groups.google.com/group/mirah/browse_thread/thread/409c1eb8cab78234

In the following code, I get an error if I include the annotation.

This compiles fine:
  defmacro test(name,&block) do
    quote {
      #$org.junit.Test
      def `name`:void
        `block.body`
      end
    }
  end

If you uncomment the annotation, it dies with the message:

Execution failed for task ':ashlar-dist:compileTestMirah'.
Cause: jmeta.SyntaxError: expected terms before ' {' (at line: 32,
char: 8)

(Line 32 is the "quote {" line.)

Changing it to "macro def" instead of "defmacro" doesn't change
anything. 


Here's a minimal example:

============================
macro def foo
  quote {
    $javax.annotation.Generated
    def bar
    end
  }
end

foo
============================ 

Not helped by using "quote do"/"end".

============================
# test.mirah
macro def foo
  quote do
    $javax.annotation.Generated
    def bar
    end
  end
end

# Results
Parsing...
  test.mirah
Exception in thread "main" mirah/impl/Mirah.mirah:4443:in `do_block':
jmeta.SyntaxError: expected statement before '          $javax.anno' (at line:
3, char: 1) (NativeException)
        from mirah/impl/Mirah.mirah:4389:in `brace_block'
        from mirah/impl/Mirah.mirah:3558:in `primary2_id'
        from mirah/impl/Mirah.mirah:2359:in `primary2'
        from mirah/impl/Mirah.mirah:1757:in `primary'
        from mirah/impl/Mirah.mirah:7105:in `lhs2'
        from mirah/impl/Mirah.mirah:7068:in `lhs'
        from mirah/impl/Mirah.mirah:1061:in `statement2'
        from mirah/impl/Mirah.mirah:681:in `statement'
============================

No difference if it's macro def or defmacro. 

"
http://code.google.com/p/mirah/issues/detail?id=52

@baroquebobcat

I reproduced this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.