-
Notifications
You must be signed in to change notification settings - Fork 302
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
[LANGUAGE] Adds music to the language #4903
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Felienne! Bellow I explain a bit about how you can make the highlighting work!
@@ -25,6 +25,7 @@ | |||
"def", | |||
"return", | |||
"print", | |||
"play", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to edit these files anymore, since they are related to Ace, and after #4924 is merged, we wouldn't need to keep mainting this files.
@@ -48,6 +48,15 @@ | |||
"next": "value", | |||
"unicode": true | |||
}, | |||
{ | |||
"regex": "(^ *)(__play__)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here!
@@ -1,8 +1,9 @@ | |||
@top Program { eol* (Command eol+)* Command? } | |||
Command { | |||
Print | Ask | Echo | Turtle | ErrorInvalid | |||
Print | Ask | Echo | Play | Turtle | ErrorInvalid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Now, we only need to edit tokens.ts
. Since we can change the keywords at run time, we can't define the keywords directly in the grammar, therefore the need for a external specializer.
Now after compiling this parser, go to tokens.ts
and modify the import for level 1 too add the play keyword. After this, go to the keywordToToken
dictionary and add the keyword in the extend
field. And at last, go to cm-editor.ts
and edit the hedyStyleTags
var to add the new keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for more information, see https://pre-commit.ci
This reverts commit fccbef8.
Hi @jpelay! I think we should merge this now I have fixed all the tests because it is already so massive! If you are ok with that (and with the changes, esp to the highlighter), can you approve this? I will make separate issues for the remaining points. |
In Spanish we also use Do-Re-Mi (mi rather than me)! I remember being taught that in elementary school haha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I LOVE this so muuuch!!!!! Also love the inclusion of numbers! Made a simple for with a print a play and it played the notes one by and one, and I thought that was pretty cool. Let's approve this and then tackle the other points in the bullet list
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
How to test
Paste this code in level 1 and be amazed!! 🤣
TODO/Notes to self:
play 21
so that we can do nice calculations with sounds?play C4 0.1
to make nicer music? Maybe in level 6 dealing with numbers of 12 dealing with floats (a bit late... I fear)play C4 E4 F4
(note.js supports this easily, just drop the sleep from the Python) That would also require changes to level 3, then we should support multiple arguments with a list_access (like print) not just onen = 'C4'
I am not sure I like that, it feels like a note should be a literal in their own right. We can change the parser to support both?)player
(fixed poorly in fccbef8)