Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions uncoder-core/app/translator/core/str_value_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class ReEndOfStrSymbol(BaseSpecSymbol):
...


class ReWordBoundarySymbol(BaseSpecSymbol):
...


class ReWordSymbol(BaseSpecSymbol):
...

Expand Down Expand Up @@ -130,6 +134,7 @@ def has_spec_symbols(self) -> bool:
SingleSymbolWildCard: "?",
UnboundLenWildCard: "*",
ReAnySymbol: ".",
ReWordBoundarySymbol: r"\b",
ReWordSymbol: r"\w",
ReDigitalSymbol: r"\d",
ReWhiteSpaceSymbol: r"\s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
ReRightParenthesis,
ReRightSquareBracket,
ReWhiteSpaceSymbol,
ReWordBoundarySymbol,
ReWordSymbol,
ReZeroOrMoreQuantifier,
ReZeroOrOneQuantifier,
Expand Down Expand Up @@ -74,6 +75,7 @@ class AQLStrValueManager(StrValueManager):
escape_manager = aql_escape_manager
container_spec_symbols_map: ClassVar[dict[type[BaseSpecSymbol], str]] = AQL_CONTAINER_SPEC_SYMBOLS_MAP
re_str_alpha_num_symbols_map: ClassVar[dict[str, type[BaseSpecSymbol]]] = {
"b": ReWordBoundarySymbol,
"w": ReWordSymbol,
"d": ReDigitalSymbol,
"s": ReWhiteSpaceSymbol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def _wrap_str_value(value: str) -> str:

def equal_modifier(self, field: str, value: DEFAULT_VALUE_TYPE) -> str:
if isinstance(value, list):
values = ", ".join(
f"{self._pre_process_value(field, str(v) if isinstance(v, int) else v, ValueType.value, True)}"
for v in value
)
values = ", ".join(f"{self._pre_process_value(field, v, ValueType.value, True)}" for v in value)
return f"{field} in ({values})"

return f"{field} = {self._pre_process_value(field, value, value_type=ValueType.value, wrap_str=True)}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
ReRightParenthesis,
ReRightSquareBracket,
ReWhiteSpaceSymbol,
ReWordBoundarySymbol,
ReWordSymbol,
ReZeroOrMoreQuantifier,
ReZeroOrOneQuantifier,
Expand Down Expand Up @@ -65,7 +66,12 @@
class SigmaStrValueManager(StrValueManager):
escape_manager = sigma_escape_manager
str_spec_symbols_map = {"?": SingleSymbolWildCard, "*": UnboundLenWildCard}
re_str_alpha_num_symbols_map = {"w": ReWordSymbol, "d": ReDigitalSymbol, "s": ReWhiteSpaceSymbol}
re_str_alpha_num_symbols_map = {
"b": ReWordBoundarySymbol,
"w": ReWordSymbol,
"d": ReDigitalSymbol,
"s": ReWhiteSpaceSymbol
}
re_str_spec_symbols_map = RE_STR_SPEC_SYMBOLS_MAP

def from_str_to_container(self, value: str) -> StrValue:
Expand Down