Skip to content

Commit

Permalink
Merge pull request #117 from mavolin/fix/115
Browse files Browse the repository at this point in the history
Ignore Braces in String and Rune Literals
  • Loading branch information
breml authored Sep 22, 2023
2 parents e380b41 + a9da6c0 commit 5f0a678
Show file tree
Hide file tree
Showing 5 changed files with 1,547 additions and 40 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ $(TEST_DIR)/issue_79/issue_79.go: $(TEST_DIR)/issue_79/issue_79.peg $(BINDIR)/pi
$(TEST_DIR)/issue_80/issue_80.go: $(TEST_DIR)/issue_80/issue_80.peg $(BINDIR)/pigeon
$(BINDIR)/pigeon -nolint $< > $@

$(TEST_DIR)/issue_115/issue_115.go: $(TEST_DIR)/issue_115/issue_115.peg $(BINDIR)/pigeon
$(BINDIR)/pigeon -nolint $< > $@

$(TEST_DIR)/left_recursion/left_recursion.go: \
$(TEST_DIR)/left_recursion/standart/leftrecursion/left_recursion.go \
$(TEST_DIR)/left_recursion/optimized/leftrecursion/left_recursion.go \
Expand Down
6 changes: 5 additions & 1 deletion grammar/pigeon.peg
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ CodeBlock ← '{' Code '}' {
return nil, errors.New("code block not terminated")
}

Code ← ( ( Comment / ![{}] SourceChar )+ / '{' Code '}' )*
Code ← ( ( Comment / CodeStringLiteral / ![{}] SourceChar )+ / '{' Code '}' )*

CodeStringLiteral ← '"' (`\"` / [^"\r\n])* '"' /
'`' [^`]* '`' /
'\'' (`\'` / [^']+) '\''

__ ← ( Whitespace / EOL / Comment )*
_ ← ( Whitespace / MultiLineCommentNoLineTerminator )*
Expand Down
194 changes: 155 additions & 39 deletions pigeon.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5f0a678

Please sign in to comment.