Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

dose pest support multi file ? #509

Closed
zsytssk opened this issue Apr 12, 2021 · 7 comments
Closed

dose pest support multi file ? #509

zsytssk opened this issue Apr 12, 2021 · 7 comments
Labels

Comments

@zsytssk
Copy link

zsytssk commented Apr 12, 2021

dose pest support multi file?

@CAD97
Copy link
Contributor

CAD97 commented Apr 12, 2021

Can you clarify?

At the moment, a grammar must be specified in a single file.

@CAD97 CAD97 added the question label Apr 12, 2021
@zsytssk
Copy link
Author

zsytssk commented Apr 13, 2021

@CAD97
I want use pest write a lang;
split file make more organize and easy to maintain.

@baoyachi
Copy link

support example?

@zsytssk
Copy link
Author

zsytssk commented Apr 13, 2021

maybe something like this:
// basic_type.pest

number = @{
    "-"?
    ~ ("0" | ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*)
    ~ ("." ~ ASCII_DIGIT*)?
    ~ (^"e" ~ ("+" | "-")? ~ ASCII_DIGIT+)?
}

char = _{
    !("\"" | "\\") ~ ANY
    | "\\" ~ ("\"" | "\\" | "/" | "b" | "f" | "n" | "r" | "t")
    | "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4})
}
inner = @{ char* }
string = ${ "\"" ~ inner ~ "\"" }

bool = {'false' | 'true'}

// value.pest

IMPORT {number, string, bool} from './basic_type';

value = {number | string | bool}

@sayrer
Copy link

sayrer commented May 9, 2021

The way I support this is to use a Bazel (or equivalent) build system that can track dependencies between files. Running cat on two files is a simple but compelling example.

https://docs.bazel.build/versions/master/be/general.html#genrule_examples

@thedodd
Copy link

thedodd commented May 27, 2021

It would definitely be quite nice to support a native import like system. Even if it was a simple native concat operation.

@singalen
Copy link

Modules are planned in #333 ("Modules" section), but the project desperately needs active maintainers.

@tomtau tomtau converted this issue into discussion #629 Jul 10, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

6 participants