Skip to content

Commit

Permalink
Fix inline function call lexed as block call if it's at the beginning…
Browse files Browse the repository at this point in the history
… of the line
  • Loading branch information
iamgio committed Sep 4, 2024
1 parent 330d686 commit ccd2f8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ class FunctionCallPatterns {
TokenRegexPattern(
name = "FunctionCall",
wrap = { FunctionCallToken(it, isBlock = true) },
// The current operation to make sure the function call is not followed by other non-function content
// is just checking if the line ends with an argument end character (}).
// This works in most cases, but it should be improved soon with some better check.
regex =
RegexBuilder("^ {0,3}call")
RegexBuilder("^ {0,3}call(?=(?:.*})?\\s*\$)")
.withReference("call", inlineFunctionCall.regex.pattern)
.build(),
// Arguments are scanned by the walker lexer.
Expand Down
2 changes: 2 additions & 0 deletions core/src/test/resources/lexing/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Paragraph

- A
- B
.inlinefunction {arg1} {arg2} {arg3}

.blockfunction {arg1} {arg2} {arg3}

.inlinefunction {arg1} {arg2} text
Expand Down

0 comments on commit ccd2f8e

Please sign in to comment.