mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-05-05 12:43:49 +00:00
try to improve parser
This commit is contained in:
parent
07eb930bd1
commit
a753a66c8d
@ -39,11 +39,11 @@ class PkgbuildToken(StrEnum):
|
|||||||
well-known tokens dictionary
|
well-known tokens dictionary
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
ArrayStarts(PkgbuildToken): (class attribute) array starts token
|
|
||||||
ArrayEnds(PkgbuildToken): (class attribute) array ends token
|
ArrayEnds(PkgbuildToken): (class attribute) array ends token
|
||||||
|
ArrayStarts(PkgbuildToken): (class attribute) array starts token
|
||||||
FunctionDeclaration(PkgbuildToken): (class attribute) function declaration token
|
FunctionDeclaration(PkgbuildToken): (class attribute) function declaration token
|
||||||
FunctionStarts(PkgbuildToken): (class attribute) function starts token
|
|
||||||
FunctionEnds(PkgbuildToken): (class attribute) function ends token
|
FunctionEnds(PkgbuildToken): (class attribute) function ends token
|
||||||
|
FunctionStarts(PkgbuildToken): (class attribute) function starts token
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ArrayStarts = "("
|
ArrayStarts = "("
|
||||||
@ -113,6 +113,10 @@ class Pkgbuild(Mapping[str, str | list[str]]):
|
|||||||
fields = {}
|
fields = {}
|
||||||
|
|
||||||
parser = shlex.shlex(stream, posix=True, punctuation_chars=True)
|
parser = shlex.shlex(stream, posix=True, punctuation_chars=True)
|
||||||
|
# ignore substitution and extend bash symbols
|
||||||
|
parser.wordchars += "${}#:+"
|
||||||
|
# in case of default behaviour, it will ignore, for example, segment part of url outside of quotes
|
||||||
|
parser.commenters = ""
|
||||||
while token := parser.get_token():
|
while token := parser.get_token():
|
||||||
try:
|
try:
|
||||||
key, value = cls._parse_token(token, parser)
|
key, value = cls._parse_token(token, parser)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user