Skip to content

Commit

Permalink
Deploying to gh-pages from @ 1ba625a 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Aug 22, 2023
1 parent 4c4a8a8 commit ded7240
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions cxxheaderparser/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LexError(CxxParseError):
else:
Protocol = object

_line_re = re.compile(r'^#line (\d+) "(.*)"')
_line_re = re.compile(r'^\#[\t ]*line (\d+) "(.*)"')
_multicomment_re = re.compile("\n[\\s]+\\*")


Expand Down Expand Up @@ -176,7 +176,6 @@ class PlyLexer:
# Comments
"COMMENT_SINGLELINE",
"COMMENT_MULTILINE",
"LINE_DIRECTIVE",
"PRAGMA_DIRECTIVE",
"INCLUDE_DIRECTIVE",
"PP_DIRECTIVE",
Expand Down Expand Up @@ -438,12 +437,6 @@ def t_NAME(self, t: LexToken) -> LexToken:
t.type = t.value
return t

@TOKEN(r'\#[\t ]*line (\d+) "(.*)"')
def t_LINE_DIRECTIVE(self, t: LexToken) -> None:
m = t.lexmatch
self.filename = m.group(2)
self.line_offset = 1 + self.lex.lineno - int(m.group(1))

@TOKEN(r"\#[\t ]*pragma")
def t_PRAGMA_DIRECTIVE(self, t: LexToken) -> LexToken:
return t
Expand All @@ -454,6 +447,12 @@ def t_INCLUDE_DIRECTIVE(self, t: LexToken) -> LexToken:

@TOKEN(r"\#(.*)")
def t_PP_DIRECTIVE(self, t: LexToken):
# handle line macros
m = _line_re.match(t.value)
if m:
self.filename = m.group(2)
self.line_offset = 1 + self.lex.lineno - int(m.group(1))
return None
# ignore C++23 warning directive
if t.value.startswith("#warning"):
return
Expand Down
2 changes: 1 addition & 1 deletion cxxheaderparser/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.0-95-gdffcbf9'
__version__ = '0.0.0-97-g1ba625a'

0 comments on commit ded7240

Please sign in to comment.