mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fix incorrect implementation of regex matching
This commit is contained in:
@@ -42,14 +42,14 @@ filter_elements_grammar = lark.Lark(
|
|||||||
location: "location" comparison value
|
location: "location" comparison value
|
||||||
query: "query:" keys comparison value
|
query: "query:" keys comparison value
|
||||||
|
|
||||||
pset: quoted_string | unquoted_string | regex_string
|
pset: quoted_string | regex_string | unquoted_string
|
||||||
prop: quoted_string | unquoted_string | regex_string
|
prop: quoted_string | regex_string | unquoted_string
|
||||||
keys: quoted_string | unquoted_string
|
keys: quoted_string | unquoted_string
|
||||||
|
|
||||||
attribute_name: /[A-Z]\\w+/
|
attribute_name: /[A-Z]\\w+/
|
||||||
ifc_class: /Ifc\\w+/
|
ifc_class: /Ifc\\w+/
|
||||||
|
|
||||||
value: special | quoted_string | unquoted_string | regex_string
|
value: special | quoted_string | regex_string | unquoted_string
|
||||||
unquoted_string: /[^.=\\s]+/
|
unquoted_string: /[^.=\\s]+/
|
||||||
quoted_string: ESCAPED_STRING
|
quoted_string: ESCAPED_STRING
|
||||||
regex_string: "/" /[^\\/]+/ "/"
|
regex_string: "/" /[^\\/]+/ "/"
|
||||||
@@ -428,7 +428,7 @@ class FacetTransformer(lark.Transformer):
|
|||||||
value = float(value)
|
value = float(value)
|
||||||
result = element_value == value
|
result = element_value == value
|
||||||
elif isinstance(value, re.Pattern):
|
elif isinstance(value, re.Pattern):
|
||||||
result = bool(value.match(element_value))
|
result = bool(value.match(element_value)) if element_value is not None else False
|
||||||
elif value in (None, True, False):
|
elif value in (None, True, False):
|
||||||
result = element_value is value
|
result = element_value is value
|
||||||
return result if comparison == "=" else not result
|
return result if comparison == "=" else not result
|
||||||
|
|||||||
Reference in New Issue
Block a user