Tweaked apostrophe rules to make %x's %y work.
This commit is contained in:
parent
02cda763c5
commit
27f89faaee
4
core.nom
4
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"
|
||||
|
||||
|
@ -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!"
|
||||
|
@ -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? ")")
|
||||
|
Loading…
Reference in New Issue
Block a user