Skip to content

Commit 3933103

Browse files
committed
Fixing macro parsing with a specific token
1 parent eae6846 commit 3933103

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arkdoc/parser/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import List
55

66
from . import Documentation, Source
7-
from .tokenizer import cpp_tokenize, tree_from_tokens, cpp_tokenize, tokenize, Token
7+
from .tokenizer import cpp_tokenize, tree_from_tokens, tokenize, Token
88
from .. import logger
99

1010

arkdoc/parser/tokenizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __str__(self):
2222
TokenSpecification = [
2323
("NUMBER", r"\d+(\.\d*)?"),
2424
("STRING", r"\"[^\"]*\""),
25+
("BEGIN_MACRO", r"!{"), # TODO: this will have to change when v4 will be delivered
2526
("ID", r"[\w:?=!@&<>+\-%*/.]+"),
2627
("LPAREN", r"[(\[{]"),
2728
("RPAREN", r"[)\]}]"),
@@ -100,7 +101,7 @@ def tree_from_tokens(tokens: List[Token]) -> List:
100101
L.append(token)
101102
token = tokens.pop(0)
102103

103-
if token.type == "LPAREN":
104+
if token.type == "LPAREN" or token.type == "BEGIN_MACRO":
104105
L2 = []
105106
while tokens[0].type != "RPAREN":
106107
L2.append(tree_from_tokens(tokens))

0 commit comments

Comments
 (0)