aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-10-30 14:08:23 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-10-30 14:08:23 -0700
commitc1ec00d5fc4bab300280f64dc55de307f860aed4 (patch)
tree7bd4b24b74cb6ff5f7e0cf95d6f4bd1745c02359
parent60a85bbd8ba7daa22e9bef48037e2480cc06dae1 (diff)
Changed it so variables can't contain wordbreakers anymore.
-rw-r--r--examples/how_do_i.nom4
-rw-r--r--nomsu.lua6
-rwxr-xr-xnomsu.moon6
3 files changed, 8 insertions, 8 deletions
diff --git a/examples/how_do_i.nom b/examples/how_do_i.nom
index 78a11e2..2480f72 100644
--- a/examples/how_do_i.nom
+++ b/examples/how_do_i.nom
@@ -203,9 +203,9 @@ rule [%what_she_said is what she said] =:
#.. The language only reserves []{}().,:;% as special characters, so functions
can have really funky names!
-rule [>> %foo_bar $$$^ --> %@ @& _~-^-~_~-^ %1 !] =:
+rule [>> %foo_bar $$$^ --> % @& _~-^-~_~-^ %1 !] =:
say %foo_bar
- say %@
+ say %
say %1
>> "wow" $$$^ --> "so flexible!" @& _~-^-~_~-^ "even numbers can be variables!" !
diff --git a/nomsu.lua b/nomsu.lua
index ee7118e..b00560c 100644
--- a/nomsu.lua
+++ b/nomsu.lua
@@ -117,9 +117,9 @@ local nomsu = [=[ file <- ({{| shebang?
number <- ({ (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / ([0-9]+)))-> tonumber) }) -> Number
- -- Variables can be nameless (i.e. just %) and can't contain apostrophes
- -- which is a hack to allow %foo's to parse as "%foo" and "'s" separately
- variable <- ({ ("%" { ((%wordbreaker+) / (%wordchar+))? }) }) -> Var
+ -- Variables can be nameless (i.e. just %) and can't contain wordbreakers like apostrophe
+ -- which is a hack to allow %'s to parse as "%" and "' s" separately
+ variable <- ({ ("%" { %wordchar* }) }) -> Var
inline_list <- ({ {|
("[" %ws? ((inline_list_item comma)* inline_list_item comma?)? %ws? "]")
diff --git a/nomsu.moon b/nomsu.moon
index 136b6ee..0c45258 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -118,9 +118,9 @@ nomsu = [=[
number <- ({ (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / ([0-9]+)))-> tonumber) }) -> Number
- -- Variables can be nameless (i.e. just %) and can't contain apostrophes
- -- which is a hack to allow %foo's to parse as "%foo" and "'s" separately
- variable <- ({ ("%" { ((%wordbreaker+) / (%wordchar+))? }) }) -> Var
+ -- Variables can be nameless (i.e. just %) and can't contain wordbreakers like apostrophe
+ -- which is a hack to allow %'s to parse as "%" and "' s" separately
+ variable <- ({ ("%" { %wordchar* }) }) -> Var
inline_list <- ({ {|
("[" %ws? ((inline_list_item comma)* inline_list_item comma?)? %ws? "]")