aboutsummaryrefslogtreecommitdiff
path: root/nomsu.peg
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-05-30 12:06:44 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-05-30 12:07:08 -0700
commite5d9879a7972fa09e8c9e8f88642bbcc27e0c5a1 (patch)
treef4eedaffb7f87be9fcc6a89db0deff5d1b233eb7 /nomsu.peg
parenta01e7d27bd3c17ef69c984866b1870b69689e9f9 (diff)
Cleaned up patterns a little.
Diffstat (limited to 'nomsu.peg')
-rw-r--r--nomsu.peg7
1 files changed, 3 insertions, 4 deletions
diff --git a/nomsu.peg b/nomsu.peg
index b705de5..f260f86 100644
--- a/nomsu.peg
+++ b/nomsu.peg
@@ -52,9 +52,9 @@ inline_action (Action):
action (Action):
{| (expression (dotdot? %ws*))* word ((dotdot? %ws*) (expression / word))* |}
-word: { %operator / (!number plain_word) }
+word: { %operator_char+ / (!number %ident_char+) }
-text_word (Text): {| {%operator / (!number plain_word)} |}
+text_word (Text): {| word |}
inline_text (Text):
!('".."' eol)
@@ -90,7 +90,7 @@ number (Number): (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / ([0-9]+)))-> tonum
-- Variables can be nameless (i.e. just %) and can't contain operators like apostrophe
-- which is a hack to allow %'s to parse as "%" and "' s" separately
-variable (Var): "%" { (plain_word ((!"'" %operator) / plain_word)*)? }
+variable (Var): "%" { (%ident_char+ ((!"'" %operator_char+) / %ident_char+)*)? }
inline_list (List):
!('[..]')
@@ -135,4 +135,3 @@ dedent: eol (%nl ignored_line)* (((!.) %dedent) / (&(%nl %dedent)))
non_dedent_error: (!dedent .)* eol (%nl ignored_line)* (!. / &%nl)
comma: %ws* "," %ws*
dotdot: nodent ".."
-plain_word: ([a-zA-Z0-9_-] / %utf8_char)+