lutaml / expressir

Ruby parser for the ISO EXPRESS language
3 stars 3 forks source link

Implement more restrictive rules in the parsing of limit character blocks in annotated EXPRESS #131

Closed manuelfuenmayor closed 1 year ago

manuelfuenmayor commented 1 year ago

In relation to https://github.com/metanorma/iso-10303-detached-docs/issues/166

In my opinion, the parsing of delimiting characters for annotated EXPRESS blocks ((* and *)) should be more restrictive. Currently, they tend to be confused with a boldfaced markup within parentheses: ... *boldfaced*).

Example:

(*"mathematical_functions_schema.basic_sparse_matrix.index"

Function providing starting locations in *loc* and *val* for the non-default pairs in
each row (if *order* = *by_rows*) or column (if *order* = *by_columns*).
Derived to be the same as the first operand.
*)

In this markup, the part = *by_columns*). is misinterpreted as the end of the annotated block, giving erroneous output:

Screenshot 2023-11-08 142312

I recommend taking the "start of line" character into account when parsing the delimiting blocks. (Or maybe there is an escape option that I should know about?)

ronaldtse commented 1 year ago

This is stated in ISO 10303-11:2004, 7.1.6.1:

Screenshot 2023-11-09 at 12 29 49 PM
NOTE Care must be taken when nesting remarks to ensure that there are matched pairs of symbols.

EXAMPLE The following is an example of nested embedded remarks.
    (* The ’(*’ symbol starts a remark, and the ’*)’ symbol ends it *)

This means that all remark opening/closing tags must be matching.

Therefore this code:

(*"mathematical_functions_schema.basic_sparse_matrix.index"

Function providing starting locations in *loc* and *val* for the non-default pairs in
each row (if *order* = *by_rows*) or column (if *order* = *by_columns*).
Derived to be the same as the first operand.
*)

Is invalid because *by_columns*) is not preceded by a (*.

The easiest way is to add a space between *by_columns* ).

ronaldtse commented 1 year ago

Closing since this is not a bug in Expressir.

@manuelfuenmayor can you please help document this in the annotated-express repo? Thanks!