Open
Description
> mkdir -p a_dir/build
> cd a_dir
> cat > A.g4 <<EOF
grammar A;
cmd : 'a' ;
EOF
> cd build
> java -classpath /usr/share/java/antlr4/antlr4.jar:/usr/share/java/antlr3-runtime.jar:/usr/share/java/antlr4/antlr4-runtime.jar:/usr/share/java/stringtemplate4/ST4.jar:/usr/share/java/treelayout/org.abego.treelayout.core.jar org.antlr.v4.Tool -o here ../A.g4
context [/report CANNOT_WRITE_FILE] 1:19 attribute arg isn't defined
error(1): cannot write file :
error(1): cannot write file AParser.java:
error(1): cannot write file A.tokens:
antlr apparently does not handle ../
paths correctly.
This is a problem in build systems as for example in meson, build
dir have to be used and antlr is supposed to take the file from srcdir. Currently, I have to first cp
the grammar to build
dir:
antlr4 = find_program('antlr4')
copy_grammar = custom_target('copy_grammar',
input : 'Make.g4',
output : 'Make.g4',
command : [ 'cp', '@INPUT@', '@OUTPUT@' ]
)
gen_antlr = custom_target('gen_antlr',
input : copy_grammar,
output : generated_files,
command : [ antlr4, '-Dlanguage=Cpp', '-message-format', 'gnu', '@INPUT@' ],
)
Metadata
Metadata
Assignees
Labels
No labels