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

Add multiline strings #34

Merged
merged 2 commits into from
Jul 29, 2022
Merged

Conversation

Markos-Th09
Copy link
Member

@Markos-Th09 Markos-Th09 commented Jul 28, 2022

This PR adds multiline stings to clue. Although regular strings can span multiple lines any tab or newline characters are not preserved. This other type of multiline strings preserves those.

The ` symbol is used to denote multiline strings

print(`
hello
world
`)

When this program is run it should output

hello
world

Copy link
Member

@Maiori44 Maiori44 left a comment

Choose a reason for hiding this comment

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

Does it need to use its own ComplexToken?
Especially for 3.0 I would need it to use SYMBOL

@Markos-Th09
Copy link
Member Author

Does it need to use its own ComplexToken? Especially for 3.0 I would need it to use SYMBOL

The problem with SYMBOL is that it is used in places where multiline string is invalid so I wasn't sure if it was a good idea to do that

@Maiori44
Copy link
Member

SYMBOL can be compiled anywhere, you just have to parse multilined strings in the right place

@Markos-Th09
Copy link
Member Author

SYMBOL can be compiled anywhere, you just have to parse multilined strings in the right place

Hmm ok let me actually make a SYMBOL only implementation of this

Copy link
Member Author

@Markos-Th09 Markos-Th09 left a comment

Choose a reason for hiding this comment

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

Implemented it without a new ComplexToken

Copy link
Member

@Maiori44 Maiori44 left a comment

Choose a reason for hiding this comment

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

I can see a much simpler and faster way to implement this, can I merge this and then change it?

@Markos-Th09
Copy link
Member Author

I can see a much simpler and faster way to implement this, can I merge this and then change it?

Sure

@Maiori44 Maiori44 merged commit 58e45a6 into ClueLang:main Jul 29, 2022
@Markos-Th09 Markos-Th09 deleted the multiline-string branch July 29, 2022 11:57
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.

None yet

2 participants