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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin: Add printf and sprintf functions #77

Merged
merged 2 commits into from
Feb 15, 2023
Merged

builtin: Add printf and sprintf functions #77

merged 2 commits into from
Feb 15, 2023

Conversation

juliaogris
Copy link
Member

Add printf and sprintf functions using Go's fmt.Sprintf (which now that we
hoist wasm code via main works 馃殌). To allow for formatted printed of
numbers and bools add and unwrap function to value.go, unwrapping the
value of the Value interface implementation for basic types only.

In the process of creating printf, we discovered some missing unescaping in
the lexing stage as the goal is to keep string handling consistent with Go
and print "\n" as newlines. Fix it and improve error message for invalid
strings.

While at fix evaluator test output for multiline test cases and failed
tests.

@github-actions
Copy link

github-actions bot commented Feb 14, 2023

firebase-deployment: https://evy-lang--77-a1lie1rx.web.app (7c7c57f)

Copy link
Contributor

@camh- camh- left a comment

Choose a reason for hiding this comment

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

This PR has a stray commit on the end I think "builting: str2num & str2bool wip"

Copy link
Contributor

@camh- camh- left a comment

Choose a reason for hiding this comment

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

LGTM apart from the stray commit

Fix evaluator failed test output from to print the output (`out`) rather
than the slice of lines which gives a for which we got on failed tests
the useless:

	panic: interface conversion: interface {} is []string, not string [recovered]
		panic: interface conversion: interface {} is []string, not string
Add printf and sprintf functions using Go's fmt.Sprintf (which now that
we hoist wasm code via main works 馃殌). To allow for formatted printed
of numbers and bools add and `unwrap` function to value.go, unwrapping
the value of the Value interface implementation for basic types only.

In the process of creating printf, we discovered some missing unescaping
in the lexing stage as the goal is to keep string handling consistent
with Go and print "\n" as newlines. Fix it and improve error message
for invalid strings.
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