Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
apalala opened this issue May 19, 2019 · 2 comments
Open

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

apalala opened this issue May 19, 2019 · 2 comments

Comments

@apalala
Copy link
Collaborator

apalala commented May 19, 2019

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
Copy link
Contributor

conao3 commented Aug 8, 2022

+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
Copy link
Contributor

conao3 commented Aug 8, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants