Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

previous attempt broke escaping from contracts in positions other than

assign #41
  • Loading branch information...
commit f692196ad4d925cc5dc9bf0bdb08c194153421b5 1 parent f6330ca
@disnet authored
Showing with 13 additions and 3 deletions.
  1. +2 −2 src/grammar.coffee
  2. +11 −1 src/nodes.coffee
View
4 src/grammar.coffee
@@ -89,6 +89,7 @@ grammar =
o 'Value'
o 'Invocation'
o 'Code'
+ o 'EscapeContract'
o 'AssignContract'
o 'Operation'
o 'Assign'
@@ -135,7 +136,7 @@ grammar =
]
EscapeContract: [
- o '? ContractExpression', -> $2
+ o '? ContractExpression', -> new EscapeContract $2
]
AssignContract: [
@@ -255,7 +256,6 @@ grammar =
# Assignment of a variable, property, or index to a value.
Assign: [
- o 'Assignable = EscapeContract', -> new Assign $1, $3, undefined, escape: true
o 'Assignable = Expression', -> new Assign $1, $3
o 'Assignable = TERMINATOR Expression', -> new Assign $1, $4
o 'Assignable = INDENT Expression OUTDENT', -> new Assign $1, $4
View
12 src/nodes.coffee
@@ -425,6 +425,16 @@ exports.Literal = class Literal extends Base
toString: ->
' "' + @value + '"'
+exports.EscapeContract = class EscapeContract extends Base
+ constructor: (@value) ->
+
+ children: ['value']
+
+ compileNode: (o) ->
+ @value.compile o
+
+
+
exports.OptionalContract = class OptionalContract extends Base
constructor: (@value) ->
@@ -1154,7 +1164,7 @@ exports.Class = class Class extends Base
# property of an object -- including within object literals.
exports.Assign = class Assign extends Base
constructor: (@variable, @value, @context, options) ->
- @escapeContract = options?.escape
+ @escapeContract = @value instanceof EscapeContract
@param = options and options.param
@subpattern = options and options.subpattern
Please sign in to comment.
Something went wrong with that request. Please try again.