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

Adopt Newspeak Setter Sends instead of Assignment Syntax #170

Merged
merged 4 commits into from
Jul 13, 2017
Merged

Conversation

smarr
Copy link
Owner

@smarr smarr commented Jul 11, 2017

This PR solves #7.

To be Newspeak spec compliant, we need to move from the classic var := 42 assignment syntax to the Newspeak setter send syntax where we got var:: 42 instead.
The main motivation for the change is compliance and the ability to load Newspeak code at some point directly.

The changes in the parser and lexer remove the previous use of an Assign symbol, and instead, following the Newspeak spec, lex a SetterKeyword. This makes sure that there can't be whitespace between the two colons.

SOMns Code Transformation

To adapt existing code, I used the following:

find . -name '*.som' -exec sed -i.bak 's/\ :=\ /:: /g' {} \;

Note that previously, multiple white spaces where allowed before the assignment :=.
To fix up parsing issues, and preserve alignment, I used this (actually I did search replace of the equivalent in my editor, so this is untested):

find . -name '*.som' -exec sed -i.bak 's/\ ::\ /::  /g' {} \;

@smarr smarr added the enhancement Improves the implementation with something noteworthy label Jul 11, 2017
@smarr smarr added this to the v0.5.0 milestone Jul 11, 2017
@smarr smarr force-pushed the setter-sends branch 3 times, most recently from 4f26ce8 to b36c759 Compare July 11, 2017 13:29
@coveralls
Copy link

Coverage Status

Coverage remained the same at 79.897% when pulling b36c759 on setter-sends into c10edd7 on dev.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

I haven't looked at all the changes, but it appears that the stream editor has worked correctly. One more step toward compliance!

- remove Assign symbol `:=`
- introduce SetterKeyword `foobar::`
- adapt parser and lexer accordingly

Signed-off-by: Stefan Marr <git@stefan-marr.de>
This was done essentially with:

find . -name '*.som' -exec sed -i.bak 's/\ :=\ /:: /g' {} \;

And n-times this:

find . -name '*.som' -exec sed -i.bak 's/\ ::\ /::  /g' {} \;

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr
Copy link
Owner Author

smarr commented Jul 13, 2017

This solves also the issue in reported in #108. It solves it in the sense that this syntactic ambiguity is gone.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 79.897% when pulling ec7f929 on setter-sends into 6c3ef7f on dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the implementation with something noteworthy
Projects
No open projects
Completeness
  
Completed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants