neogeny / TatSu

竜 TatSu generates Python parsers from grammars in a variation of EBNF
https://tatsu.readthedocs.io/
Other
408 stars 48 forks source link

#include fails to look on same directory as source #125

Open apalala opened 5 years ago

apalala commented 5 years ago

With base.ebnf and full.ebnf in the same directory with:

#include :: base.ebnf

Will search for the include in the current or parent directory, and fail.

conao3 commented 2 years ago

+1. And I found another issue. When #include are chained, the first #include must be written from the parent directory, but the next #include must be written with a relative path.

conao3 commented 2 years ago

include :: "python-paml/src/paml/lib/grammar/yaml.ebnf"

- yaml.ebnf

@@grammar :: YAML @@whitespace :: // @@parseinfo :: True

include :: "json.ebnf"


- json.ebnf

@@grammar :: JSON @@whitespace :: // @@parseinfo :: True

start = jsonvalue $ ;

jsonobject = '{' ws ','%{ ws jsonstring ws ':' ws jsonvalue ws }* '}' ;

jsonarray = '[' ','%{ jsonvalue }* ']' ;

jsonvalue = ws jsonvalue_ ws;

jsonvalue_ = | jsonfalse | jsontrue | jsonnull | jsonobject | jsonarray | jsonnumber | jsonstring ;

jsonnumber = jsonfloat | jsonint; jsonint = /[0-9]+/ ; jsonfloat = /[0-9]+.[0-9]+/ ; jsonstring = /"[^"]"/ ; jsontrue = /true/ ; jsonfalse = /false/ ; jsonnull = /null/ ; ws = /[ \t\n\r]/ ;