fastmodel: only support single line literal when paring project file

In python3.11, it requires the global specifier should be the first
token of regex. However it's not possible when using ply library. In
fastmodel case, we actually don't need to support multiline string
literal. We fix this issue by just making the string literal single
line.

Ref: https://github.com/dabeaz/ply/issues/282

Change-Id: I746b628db7ad4c1d7834f1a1b2c1243cef68aa01
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71018
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Yu-hsin Wang
2023-05-30 13:26:18 +08:00
parent 9a27322c7b
commit 23a88d0400

View File

@@ -218,10 +218,9 @@ class ProjectFileParser(Grammar):
t_ID = r'[A-Za-z_]\w*'
def t_STRLIT(self, t):
r'(?m)"([^"])*"'
r'"([^"])*"'
# strip off quotes
t.value = t.value[1:-1]
t.lexer.lineno += t.value.count('\n')
return t
t_EQUALS = r'='