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

Import statement parser #362

Merged
merged 6 commits into from
Jan 30, 2025
Merged

Import statement parser #362

merged 6 commits into from
Jan 30, 2025

Conversation

simerplaha
Copy link
Member

@simerplaha simerplaha requested a review from tdroxler January 30, 2025 03:09
)
),
endQuote = Quote(indexOf("""import "folder/file.ral>>"<<"""))
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if we have no double quotes?

import folder/file.ral

how will it parse?

Copy link
Member Author

@simerplaha simerplaha Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will parse import with an undefined/empty path. So during processing, nothing gets imported.

folder/file.ral will get parsed as the next valid syntax i.e. infix expression, which in this case is division. This syntax is valid in the following case:

let folder = 1
let file = <<SomeContractOrObject instance>> // this object could contain `ral` either as a value or a function.
let division_result = folder / file.ral

The parser will always try to match the syntax to a the next valid grammar.

Copy link
Member

@tdroxler tdroxler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment, otherwise LGTM

@simerplaha simerplaha merged commit fedfc94 into master Jan 30, 2025
3 checks passed
@simerplaha simerplaha deleted the import_parser branch January 30, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants