yohasebe/rsyntaxtree

Escaping of Square Brackets Not Working

Opened this issue · 2 comments

zyf722 commented

Hi there,

I've encountered an issue with the escaping of square brackets in RSyntaxTree 1.2.10, which I'm currently using for building syntax parse trees for multi-dimensional array references.

It seems that the parser is not correctly escaping the [ and ] characters. Here's the code that reproduces the issue:

[expr
  [id x
  
  ]
  [suffix
    \[
    [id 2
    
    ]
    \]
    [suffix
      \[
      [id 3
      
      ]
      \]
      [suffix
        \[
        [id 4
        
        ]
        \]
      ]
    ]
  ]
]

This will generate the following tree, which is incorrect:
image

By replace all \[ and \] with \( and \), an expected tree could be generated:
image

Any assistance or guidance would be greatly appreciated.

Hi, sorry for my belated response.

Thank you for pointing out this issue that happens when a pair of escaped brackets is embedded within another.

I cannot say when it is possible, but I'll try to solve the issue the next time I work on the code!

This problem has been corrected in version 1.3.1.