pml-lang / pml-companion

Java source code of the 'PML Companion (PMLC)'
https://www.pml-lang.dev
GNU General Public License v2.0
22 stars 1 forks source link

List element with parentheses errs #53

Closed coemgenuslcp closed 3 years ago

coemgenuslcp commented 3 years ago

If the el node begins with an open parenthesis, the compiler errs as below. What is the error message talking about when it says it expects a =? Are parentheses special?

[el (some) text here]
Error: Expecting attribute assignment operator '='.
                [el (some >>> ) text here]
pml-lang commented 3 years ago

Parenthesis are used to embed attribute assignments, e.g.

[node_name ( a1 = v1  a2 = v2 ) content]

In some cases the parenthesis are optional (lenient parsing). In your case the compiler thinks that some is an attribute name. Therefore it expects the =. If a node has no attributes, but text that starts with ( (as in your case), one has to explicitly state that there are no attributes, by using ():

[el () (some) text here]

Note: This behavior will slightly change and will be better documented in PML 2.0 (a major update scheduled to be published next month). For example, the space after el in the above code is required in PML 1.5, but will be optional in PML 2.0. You'll be able to write:

[el() (some) text here]

or even:

[el()(some) text here]
pml-lang commented 3 years ago

In version 2.0.0 chapter Lenient Parsing has been added to document the behavior.