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

Parser problems #225

Open
3 of 4 tasks
jpcima opened this issue May 13, 2020 · 5 comments
Open
3 of 4 tasks

Parser problems #225

jpcima opened this issue May 13, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@jpcima
Copy link
Collaborator

jpcima commented May 13, 2020

Some current parser problems, checked against ARIA and Cakewalk.


If the variable expands to another string with dollar, it should be expanded again.
Example:

#define $A 1
#define $B $A
$B

⇒ 1


#define $A foo bar

In ARIA, the value of A is foo. Anything which follows is parsed like SFZ syntax.
In Cakewalk, the value of A is foo bar.

This means also in ARIA you can write such things as:
#define $A foo #define $B bar


  • don't left-trim the #define value (probable bug, not implemented unless necessary)
    validity: ARIA

Example:

#define $A   foo

The value of A will be " foo", with the spaces included.
In Cakewalk, the value is left-trimmed.


  • expand the dollar variables across several tokens of the grammar
    validity: ARIA, Cakewalk

Example:

#define $MyOpcodes sample=*sine
//This form Cakewalk-only:  #define $MyOpcodes pitch_keycenter=69 sample=*sine
<region> $MyOpcodes

In Cakewalk, the example is treated as two opcodes in a region.
In ARIA, this is only the first opcode in the region, because is stopped reading the value at the first space. (see other case above)

@jpcima
Copy link
Collaborator Author

jpcima commented May 13, 2020

Since there's apparently out there some ARIA files which depend on
Example: #define $A 1 #define $B 2

#230 implements it same as ARIA, which is to stop reading the value as soon as whitespace is encountered. It contradicts Cakewalk behavior which extracts all the line.

We should decide a middle-ground solution for compatibility.

One idea is to examine the text under cursor when meeting a space. (eg. just after "1" in the example above)
If the lookahead is '#', '<', or some "opcode=[...]", we may stop reading the value there, otherwise continue.

@paulfd
Copy link
Member

paulfd commented Jul 3, 2020

So the 4th item

expand the dollar variables across several tokens of the grammar (validity: ARIA, Cakewalk)

is also handled by #230?

@jpcima
Copy link
Collaborator Author

jpcima commented Jul 3, 2020

No this one is significantly harder in the state of things.
Hopefully, there aren't many files out there using this crazy form.

When tokens are expanded as a result of $-expansion, there isn't an adequate SourceRance to assign to them.
This would have to be handled in a simliar way to how libclang does.
Essentially it's a distinction between a file location and a semantic location, where the latter points to the content of a macro expansion.

Then after having this, the next problem is to reexamine the way how to process the character stack.
In case of ungetting chars, it has to track whether the character source is from a $-expansion or from file, and keep the state accordingly.

@jpcima
Copy link
Collaborator Author

jpcima commented May 1, 2021

  • more fun with ARIA and definitions
    #define $give <region> #define $me$ sample=* $give$me$sine

@paulfd paulfd added the bug Something isn't working label Nov 22, 2021
@paulfd
Copy link
Member

paulfd commented Dec 29, 2021

Meh. I was hopeful about this one thinking "Ho, having #define $MyOpcodes opcode1=value1 opcode2=value2 ... would be a compatible way to implement composition rather than hierarchies in SFZ file" but it doesn't work in ARIA then...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants