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

Allow else if #91

Merged
merged 2 commits into from
Aug 2, 2024
Merged

Allow else if #91

merged 2 commits into from
Aug 2, 2024

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Aug 2, 2024

  • else if in parsing
  • pretty print them specially
if (i>=3) {10} else if (i>=2) {20} else {30}

initially parsed and printed as

if i >= 3 {
	10
} else {
	if i >= 2 {
		20
	} else {
		30
	}
}

which was correct but ugly, now

if i >= 3 {
	10
} else if i >= 2 {
	20
} else {
	30
}

🎉

fixes #87

@ldemailly ldemailly marked this pull request as ready for review August 2, 2024 17:31
@ldemailly ldemailly requested a review from ccoVeille August 2, 2024 17:36
@ldemailly
Copy link
Member Author

this one is pretty cool to look at, it's only a few lines in parser, the rest is test and pretty print handling
(fyi async review @ccoVeille )

@ldemailly ldemailly merged commit d8fedc3 into main Aug 2, 2024
1 check passed
@ldemailly ldemailly deleted the else_if branch August 2, 2024 17:36
ldemailly added a commit that referenced this pull request Aug 2, 2024
ldemailly added a commit that referenced this pull request Aug 2, 2024
…#92)

* follow up on #91

* Fixes #44: allow func name(...) {...} for name=func(...

* use the expected short hand on the web example

* change fib example to be shorter and use the short hand of func name()

* share common part of SetCacheKey and Inspect (with name) for functions

* further share inspect/cachekey code
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.

add elseif (or else if)
2 participants