metaborg / stratego

Apache License 2.0
10 stars 7 forks source link

SpoofaxWithCore/159: fix String escaping in Stratego #1

Closed oskar-van-rest closed 3 years ago

oskar-van-rest commented 8 years ago

These changes extend Stratego such that the String and the Char in Stratego become super-classes of the String and the Char in Java (and many other languages). Let me know if you want me to make it entirely consistent with Java (i.e. not a super class nor a sub class). That would break backwards compatibility. Also see the comments I added in the code. If not this code is good to be merged.

I tested by running ./b build -st all. Then I installed the generated update site into Eclipse and verified manually that the new escaping rules (e.g. "\'") are working correctly.

eelcovisser commented 8 years ago

This only concerns the syntax of Stratego in the editor, right? Did you also fix the grammar used by the compiler? (https://github.com/metaborg/strategoxt/tree/master/strategoxt/syntax/stratego-front/syn)

oskar-van-rest commented 8 years ago

I didn't realize there are so many copies of this grammar. Please see https://github.com/oskar-van-rest/strategoxt/commit/31a9f9c4d7225ba1c12ae7476137667037db2891

As far as I can tell I covered everything now, but the build fails:

build-stratego:
    [mkdir] Created dir: /home/oskar/repos/spoofax-releng/strategoxt/strategoxt/stratego-libraries/lib/bin/stratego/org/strategoxt/stratego_lib
     [echo] ========================================================================================
     [echo] spec/stratego-lib-posix-xsi.str -> bin/stratego/org/strategoxt/stratego_lib/Main.java
     [echo] ========================================================================================
     [echo] 
     [echo] ========================================================================================
     [echo] spec/stratego-lib-posix-xsi.str -> /home/oskar/repos/spoofax-releng/strategoxt/strategoxt/stratego-libraries/lib/spec/libstratego-lib-posix-xsi.ctree
     [echo] ========================================================================================
     [echo] 
[ Main | error ] /home/oskar/repos/spoofax-releng/strategoxt/strategoxt/stratego-libraries/lib/spec/term/string.str: Syntax error near unexpected character 'b' at line 275, column 54
parse error in /home/oskar/repos/spoofax-releng/strategoxt/strategoxt/stratego-libraries/lib/spec/term/string.str
parse error in /home/oskar/repos/spoofax-releng/strategoxt/strategoxt/stratego-libraries/lib/spec/term/string.str

Please point me to the grammar definition that is used for parsing spoofax-releng/strategoxt/strategoxt/stratego-libraries/lib/spec/term/string.str.

Gohla commented 8 years ago

Sounds like a bootstrapping problem, StrategoXT is built with a previous version of StrategoXT.

Apanatshka commented 3 years ago

Given the bootstrapping problem and how long this has been open, I won't merge this. I will take in these changes in the Stratego 2 grammar, to incorporate it into the future of Stratego.