adding nice support for fancy implicit hashes
This commit is contained in:
parent
d1ffffab04
commit
a0b2b78962
|
@ -87,6 +87,10 @@
|
|||
return new AssignNode(new ValueNode($1), $3, 'object');
|
||||
}), o("AlphaNumeric : Expression", function() {
|
||||
return new AssignNode(new ValueNode($1), $3, 'object');
|
||||
}), o("Identifier : INDENT Expression OUTDENT", function() {
|
||||
return new AssignNode(new ValueNode($1), $4, 'object');
|
||||
}), o("AlphaNumeric : INDENT Expression OUTDENT", function() {
|
||||
return new AssignNode(new ValueNode($1), $4, 'object');
|
||||
}), o("Comment")
|
||||
],
|
||||
Return: [
|
||||
|
|
|
@ -599,7 +599,7 @@
|
|||
JS_CLEANER = /(^`|`$)/g;
|
||||
MULTILINER = /\n/g;
|
||||
STRING_NEWLINES = /\n[ \t]*/g;
|
||||
NO_NEWLINE = /^([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/;
|
||||
NO_NEWLINE = /^([+\*&|\/\-%=<>!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/;
|
||||
HEREDOC_INDENT = /(\n+([ \t]*)|^([ \t]+))/g;
|
||||
ASSIGNED = /^([a-zA-Z\$_]\w*[ \t]*?[:=][^=])/;
|
||||
NEXT_CHARACTER = /^\s*(\S)/;
|
||||
|
|
394
lib/parser.js
394
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -149,6 +149,8 @@ grammar = {
|
|||
o "AlphaNumeric"
|
||||
o "Identifier : Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
||||
o "AlphaNumeric : Expression", -> new AssignNode new ValueNode($1), $3, 'object'
|
||||
o "Identifier : INDENT Expression OUTDENT", -> new AssignNode new ValueNode($1), $4, 'object'
|
||||
o "AlphaNumeric : INDENT Expression OUTDENT", -> new AssignNode new ValueNode($1), $4, 'object'
|
||||
o "Comment"
|
||||
]
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ REGEX_ESCAPE = /\\[^\$]/g
|
|||
JS_CLEANER = /(^`|`$)/g
|
||||
MULTILINER = /\n/g
|
||||
STRING_NEWLINES = /\n[ \t]*/g
|
||||
NO_NEWLINE = /^([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/
|
||||
NO_NEWLINE = /^([+\*&|\/\-%=<>!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/
|
||||
HEREDOC_INDENT = /(\n+([ \t]*)|^([ \t]+))/g
|
||||
ASSIGNED = /^([a-zA-Z\$_]\w*[ \t]*?[:=][^=])/
|
||||
NEXT_CHARACTER = /^\s*(\S)/
|
||||
|
|
|
@ -116,3 +116,19 @@ func = ->
|
|||
this == 'this'
|
||||
|
||||
ok func() is false
|
||||
|
||||
|
||||
# New fancy implicit objects:
|
||||
config =
|
||||
development:
|
||||
server: 'localhost'
|
||||
timeout: 10
|
||||
|
||||
production:
|
||||
server: 'dreamboat'
|
||||
timeout: 1000
|
||||
|
||||
ok config.development.server is 'localhost'
|
||||
ok config.production.server is 'dreamboat'
|
||||
ok config.development.timeout is 10
|
||||
ok config.production.timeout is 1000
|
Loading…
Reference in New Issue