ruststep icon indicating copy to clipboard operation
ruststep copied to clipboard

Fix bug in literal parsing

Open Nahuel-M opened this issue 2 years ago • 0 comments

A literal called TrueNorth will be parsed as Literal::Logical True + remainder "North", instead of being parsed as Literal::String "TrueNorth"

I encountered this while trying to parse the IFC express schema.

The following example triggers the issue:

let st = espr::ast::SyntaxTree::parse(
  "SCHEMA IFC4X3_DEV_6a23ae8;
  ENTITY IfcGeometricRepresentationContext;
   WHERE
	  North2D : NOT(EXISTS(TrueNorth)) OR (HIINDEX(TrueNorth.DirectionRatios) = 2);
  END_ENTITY;
  
  END_SCHEMA;"
).unwrap();

I expect this is fixable using nom::combinator::peek to check for a following character. Are you accepting pull requests?

Nahuel-M avatar Aug 14 '23 12:08 Nahuel-M