@@ -59,7 +59,7 @@ def __init__(self, subs: list[dict], capture_rules: list[dict]) -> None:
5959_CONSTRAINTS = {"before" , "after" , "not_before" , "not_after" }
6060# Stdlib aliases usable as bare names (Ruby Stdlib::ALIASES, resolved
6161# before doc-local aliases, mirroring the interpreter's lookup order).
62- _STDLIB_EXPR = {"alpha" , "digit" , "word" , "any_character" }
62+ _STDLIB_EXPR = {"alpha" , "digit" , "word" , "not_word" , " any_character" }
6363# Tokens that terminate an item inside a rule; a bare word equal to one
6464# of these is a keyword, never an alias reference.
6565_KEYWORDS = _CONSTRAINTS | {"to" , "from" , "note" }
@@ -768,7 +768,7 @@ def _regex_of(item: dict, aliases: dict[str, str]) -> str:
768768 if item .get ("map" ):
769769 return _qualified_regex (item ["map" ], name )
770770 if name in _STDLIB_EXPR :
771- return {"alpha" : "[a-zA-Z]" , "digit" : "[0-9]" , "word" : "[a-zA-Z0-9_]" , "any_character" : "." }[name ]
771+ return {"alpha" : "[a-zA-Z]" , "digit" : "[0-9]" , "word" : "[a-zA-Z0-9_]" , "not_word" : "[^a-zA-Z0-9_]" , " any_character" : "." }[name ]
772772 if name in _imported :
773773 return _qualified_regex (None , name )
774774 if name not in aliases :
@@ -875,7 +875,10 @@ def _stage_tree(
875875 dep = body_item .get ("dependency" )
876876 if dep :
877877 target = dep_aliases .get (dep , dep )
878- return {"kind" : "run" , "map" : target }
878+ op = {"kind" : "run" , "map" : target }
879+ if body_item .get ("stage" ):
880+ op ["stage" ] = body_item ["stage" ]
881+ return op
879882 return {"kind" : "run_stage" , "name" : body_item ["stage" ]}
880883 if kind in ("compose" , "decompose" ):
881884 return {"kind" : kind }
@@ -979,7 +982,14 @@ def _library_aliases(name: str, libs_dir: Path) -> dict[str, str]:
979982 # Library aliases may reference aliases defined earlier
980983 # in the same file (var-kor: jamo = any([jamo_leading_cons,
981984 # ...])); substitute them, outside string literals only.
982- aliases [m .group (1 )] = _subst_alias_refs (value , aliases )
985+ value = _subst_alias_refs (value , aliases )
986+ # A library alias holding a bare string acts as a
987+ # character class inside any() (measured: the unicode
988+ # library's greek); an in-map string alias would be a
989+ # literal sequence instead.
990+ if re .fullmatch (r'"(?:[^"\\]|\\.)*"' , value ):
991+ value = f"any({ value } )"
992+ aliases [m .group (1 )] = value
983993 _LIB_CACHE [name ] = aliases
984994 return aliases
985995
0 commit comments