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

Process syntax statements during scanning (in import / use) #25

Open
c3d opened this issue Feb 8, 2020 · 0 comments
Open

Process syntax statements during scanning (in import / use) #25

c3d opened this issue Feb 8, 2020 · 0 comments

Comments

@c3d
Copy link
Owner

c3d commented Feb 8, 2020

A syntax statement within an imported file will not currently change the syntax in the importing file, only locally.

In order for the syntax extensions to propagate to the importing file, we need the scanner and parser to recognize that there is a syntax statement, mark it so that import will be aware of it. That, in turn, may require import to be processed early, e.g. during scanning.

Example:

// imported.xl
module IMPORTED with
    syntax { POSTFIX 130 cm mm km dm m }
    type distance is matching (D:real m)
    D:real km as distance is (D * 1000) m
    D:real mm as distance is (D * 0.001) m

// Importing file
use IMPORTED

D : distance := 3.2km
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

1 participant