aboutsummaryrefslogtreecommitdiff
path: root/nomsu.peg
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-01-30 15:13:04 -0800
committerBruce Hill <bitbucket@bruce-hill.com>2018-01-30 15:13:13 -0800
commit78c15a5d5e9336f0164161c77c0441b41c226895 (patch)
tree236e1fd1a1018cfd844cc9b0373a30c26fe888f0 /nomsu.peg
parent056357162551993e3e7d3a0ac778ed46aafdc083 (diff)
Removed indented interpolations for inline strings.
Diffstat (limited to 'nomsu.peg')
-rw-r--r--nomsu.peg12
1 files changed, 9 insertions, 3 deletions
diff --git a/nomsu.peg b/nomsu.peg
index ae3e488..4586fcc 100644
--- a/nomsu.peg
+++ b/nomsu.peg
@@ -39,7 +39,7 @@ inline_text (Text):
!('".."' eol)
'"' {|
({~ (('\"' -> '"') / ('\\' -> '\') / %escaped_char / [^%nl\"])+ ~}
- / text_interpolation)*
+ / inline_text_interpolation)*
|} '"'
-- Have to use "%indent" instead of "indent" etc. to avoid messing up text lines that start with "#"
indented_text (Text):
@@ -50,14 +50,20 @@ indented_text (Text):
/ (%nl+ {~ %nodent -> "" ~}) / [^%nl\])+
~} / text_interpolation)*
|} (((!.) &%dedent) / (&(%nl %dedent)) / (("" -> "Error while parsing Text") => error))
-text_interpolation:
+inline_text_interpolation:
"\" (
variable / inline_list / inline_dict / inline_text
/ ("(" %ws* (inline_functioncall / inline_expression) %ws* ")")
+ )
+text_interpolation:
+ inline_text_interpolation /
+ ("\" (
+ variable / inline_list / inline_dict / inline_text
+ / ("(" %ws* (inline_functioncall / inline_expression) %ws* ")")
/ (%ws* (block_comment / line_comment)? nodent "..")
/ (indented_text %nl+ %nodent "..")
/ ((indented_list / indented_block) nodent "..")
- )
+ ))
number (Number): (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / ([0-9]+)))-> tonumber)