dropbox / djinni

A tool for generating cross-language type declarations and interface bindings.
Apache License 2.0
2.88k stars 488 forks source link

Bug on DSL parser #430

Closed paulocoutinhox closed 5 years ago

paulocoutinhox commented 5 years ago

Hi,

I think i found bug on DSL parser.

When i use this order in my djinni project i found error:

# Domain interfaces

@extern "../build/djinni/yaml/enums/search_param_downloaded_type_enum.yaml"
@extern "../build/djinni/yaml/enums/search_param_order_ascending_type_enum.yaml"

product = record {
    ...
}
...
/Users/paulo/Developer/workspaces/cpp/xyz-library-core/source/local/dependency-core/djinni/domain.djinni (3.1): string matching regex `[A-Za-z_][A-Za-z_0-9]*' expected but `@' found

But when o remove the comments before "@extern", djinni works.

artwyman commented 5 years ago

That's not technically a bug so much as a missing/confusing feature. Djinni doesn't have a general comment syntax, it has a documentation syntax. Documentation comments need something to attach to, and @extern doesn't have any place for documentation. Similarly you can't put doc comment at the end of a file, since it doesn't attach to anything. See #53 for more discussion.