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

Tonel doesn't support custom #compilerClass #119

Open
syrel opened this issue Oct 20, 2023 · 0 comments
Open

Tonel doesn't support custom #compilerClass #119

syrel opened this issue Oct 20, 2023 · 0 comments

Comments

@syrel
Copy link

syrel commented Oct 20, 2023

The ability to override Behavior>>#compilerClass is a great feature that shows the power of Pharo. Unfortunately, Tonel is designed to only handle valid Smalltalk code inside of the method body. Which contradicts custom compilers.

Imagine if ones creates a compiler that changes comment syntax from double quotes "comment" to double slash // comment.

Such method would be written as follows in a Tonel file:

{ #category : #accessing }
MyClass >> method [
	// this example shows the new syntax that's great
	^ 42
]

Notice that there is a single quote ' inside of the comment. Because Tonel matches blocks, strings and comments, the method is not loadable. Here is how to reproduce it:

(TonelSourceScanner on: '[
	// this example shows the new syntax that''s great
	^ 42
]' readStream) scan

What is your vision of the future of Tonel? Will it only handle valid smalltalk code?

A possible solution would be to escape all special characters and only match unescaped [ ] to detect a method body.

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

No branches or pull requests

1 participant