From 07cbdd3ded2a392526f148ffbddd1478ab67e6e7 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 30 Nov 2024 19:03:10 +0100 Subject: [PATCH] Use raw strings for regex strings in parser/keyword.py --- parser/keyword.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parser/keyword.py b/parser/keyword.py index 16e69e39..ba4b2c31 100644 --- a/parser/keyword.py +++ b/parser/keyword.py @@ -6,9 +6,9 @@ class KeyWordParser(parser.Parser): def __init__(self, pctxt): parser.Parser.__init__(self, pctxt) self.keywordPattern = re.compile(r'^(%s%s)(%s)' % ( - '([a-z0-9\-\+_\.]*[a-z0-9\-\+_)])', # keyword - '( [a-z0-9\-_]+)*', # subkeywords - '(\([^ ]*\))?', # arg (ex: (), (/), (,[,]) ... + r'([a-z0-9\-\+_\.]*[a-z0-9\-\+_)])', # keyword + r'( [a-z0-9\-_]+)*', # subkeywords + r'(\([^ ]*\))?', # arg (ex: (), (/), (,[,]) ... )) def parse(self, line): @@ -25,7 +25,7 @@ def parse(self, line): keyword = parsed.group(1) arg = parsed.group(4) parameters = line[len(keyword) + len(arg):] - if (parameters != "" and not re.match("^ +(/?(<|\[|\{).*|(: [a-z0-9 +]+))?(\(deprecated\))?$", parameters)): + if (parameters != "" and not re.match(r"^ +(/?(<|\[|\{).*|(: [a-z0-9 +]+))?(\(deprecated\))?$", parameters)): # Dirty hack # - parameters should only start with the character "<", "[", "{", and in rare cases with an extra "/" # - or a column (":") followed by a alpha keywords to identify fetching samples (optionally separated by the character "+")