Fix #3705. Fix ambiguity in using commas in unquoted strings in facet selector.

This commit is contained in:
Dion Moult
2023-09-06 16:34:39 +10:00
parent 28eeba49ba
commit ba4610155f
2 changed files with 4 additions and 1 deletions
@@ -51,7 +51,7 @@ filter_elements_grammar = lark.Lark(
ifc_class: /Ifc\\w+/
value: special | quoted_string | regex_string | unquoted_string
unquoted_string: /[^.=\\s]+/
unquoted_string: /[^,.=\\s]+/
regex_string: "/" /[^\\/]+/ "/"
quoted_string: ESCAPED_STRING
@@ -147,6 +147,9 @@ class TestFilterElements(test.bootstrap.IFC4):
assert subject.filter_elements(self.file, 'IfcWall, Name="Foo\'s \\"quoted\\" name..."') == {element}
assert subject.filter_elements(self.file, "IfcWall, Name=/Fo.*/") == {element}
assert subject.filter_elements(self.file, "IfcWall, Description=NULL") == {element, element2}
element.Name = "Foo"
element.Description = "Foobar"
assert subject.filter_elements(self.file, "IfcWall, Name=Foo, Description=Foobar") == {element}
def test_selecting_by_type(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")