aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core.nom4
-rw-r--r--examples/parser_tests.nom8
-rwxr-xr-xnomsu.moon4
3 files changed, 11 insertions, 5 deletions
diff --git a/core.nom b/core.nom
index 110fd18..b43d264 100644
--- a/core.nom
+++ b/core.nom
@@ -285,9 +285,9 @@ rule "dict %items":
lua block "vars.dict[vars.pair[1]] = vars.pair[2]"
return %dict
-rule "%dict -> %key":
+rule "%dict 's %key":
lua expr "vars.dict[vars.key]"
-rule "%dict -> %key = %value":
+rule "%dict 's %key = %value":
lua block "vars.dict[vars.key] = vars.value"
diff --git a/examples/parser_tests.nom b/examples/parser_tests.nom
index 4f8af85..d506d2a 100644
--- a/examples/parser_tests.nom
+++ b/examples/parser_tests.nom
@@ -192,6 +192,12 @@ test:
test:
don't fuck this up
..yields ".."
- |Call [don't fuck this up]!
+ |Call [don 't fuck this up]!
+
+test:
+ %Brian's hat
+..yields ".."
+ |Call [% 's hat]:
+ | Var[Brian]
say "All tests passed!"
diff --git a/nomsu.moon b/nomsu.moon
index a27354a..90c847e 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -194,7 +194,7 @@ class NomsuCompiler
((%indent %new_line block ((%dedent (%new_line "..")?) / errors))
/ (one_liner (%ws? (%new_line? ".."))?)) }) -> Thunk
- word <- ({ !number {%wordchar+} }) -> Word
+ word <- ({ !number {%wordchar (!"'" %wordchar)*} }) -> Word
expression <- ({ (longstring / string / number / variable / list / thunk / subexpression) }) -> Expression
string <- ({ (!longstring) '"' {(("\" [^%nl]) / [^"%nl])*} '"' }) -> String
@@ -210,7 +210,7 @@ class NomsuCompiler
|}}) -> Longstring
string_interpolation <- "\" %ws? (functioncall / expression) %ws? "\"
number <- ({ {'-'? [0-9]+ ("." [0-9]+)?} }) -> Number
- variable <- ({ ("%" {%wordchar+}) }) -> Var
+ variable <- ({ ("%" {%wordchar (!"'" %wordchar)*}) }) -> Var
subexpression <-
("(" %ws? (functioncall / expression) %ws? ")")