TatSu icon indicating copy to clipboard operation
TatSu copied to clipboard

#include fails to look on same directory as source

Open apalala opened this issue 6 years ago • 2 comments

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.

apalala avatar May 19 '19 04:05 apalala

+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 avatar Aug 08 '22 01:08 conao3

  • src tree
$ tree python-paml/src
python-paml/src
└── paml
    ├── cli.py
    └── lib
        ├── __init__.py
        ├── grammar
        │   ├── json.ebnf
        │   ├── paml.ebnf
        │   └── yaml.ebnf
        ├── main.py
        └── parser.py
  • paml.ebnf
@@grammar :: PAML
@@whitespace :: //
@@parseinfo :: True

#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]*/ ;

conao3 avatar Aug 08 '22 01:08 conao3