scratch – Diff between revs 75 and 125

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 75 Rev 125
Line 2... Line 2...
2 Pattern = require './Pattern' 2 Pattern = require './Pattern'
3 Unescaper = require './Unescaper' 3 Unescaper = require './Unescaper'
4 Escaper = require './Escaper' 4 Escaper = require './Escaper'
5 Utils = require './Utils' 5 Utils = require './Utils'
6 ParseException = require './Exception/ParseException' 6 ParseException = require './Exception/ParseException'
-   7 ParseMore = require './Exception/ParseMore'
7 DumpException = require './Exception/DumpException' 8 DumpException = require './Exception/DumpException'
Line 8... Line 9...
8   9  
9 # Inline YAML parsing and dumping 10 # Inline YAML parsing and dumping
Line 209... Line 210...
209 # @param [String] scalar 210 # @param [String] scalar
210 # @param [Object] context 211 # @param [Object] context
211 # 212 #
212 # @return [String] A YAML string 213 # @return [String] A YAML string
213 # 214 #
214 # @throw [ParseException] When malformed inline YAML string is parsed 215 # @throw [ParseMore] When malformed inline YAML string is parsed
215 # 216 #
216 @parseQuotedScalar: (scalar, context) -> 217 @parseQuotedScalar: (scalar, context) ->
217 {i} = context 218 {i} = context
Line 218... Line 219...
218   219  
219 unless match = @PATTERN_QUOTED_SCALAR.exec scalar[i..] 220 unless match = @PATTERN_QUOTED_SCALAR.exec scalar[i..]
Line 220... Line 221...
220 throw new ParseException 'Malformed inline YAML string ('+scalar[i..]+').' 221 throw new ParseMore 'Malformed inline YAML string ('+scalar[i..]+').'
Line 221... Line 222...
221   222  
222 output = match[0].substr(1, match[0].length - 2) 223 output = match[0].substr(1, match[0].length - 2)
Line 237... Line 238...
237 # @param [String] sequence 238 # @param [String] sequence
238 # @param [Object] context 239 # @param [Object] context
239 # 240 #
240 # @return [String] A YAML string 241 # @return [String] A YAML string
241 # 242 #
242 # @throw [ParseException] When malformed inline YAML string is parsed 243 # @throw [ParseMore] When malformed inline YAML string is parsed
243 # 244 #
244 @parseSequence: (sequence, context) -> 245 @parseSequence: (sequence, context) ->
245 output = [] 246 output = []
246 len = sequence.length 247 len = sequence.length
247 {i} = context 248 {i} = context
Line 280... Line 281...
280   281  
Line 281... Line 282...
281 --i 282 --i
Line 282... Line 283...
282   283  
Line 283... Line 284...
283 ++i 284 ++i
284   285  
285 throw new ParseException 'Malformed inline YAML string '+sequence 286 throw new ParseMore 'Malformed inline YAML string '+sequence
286   287  
287   288  
288 # Parses a mapping to a YAML string. 289 # Parses a mapping to a YAML string.
289 # 290 #
290 # @param [String] mapping 291 # @param [String] mapping
291 # @param [Object] context 292 # @param [Object] context
292 # 293 #
293 # @return [String] A YAML string 294 # @return [String] A YAML string
294 # 295 #
295 # @throw [ParseException] When malformed inline YAML string is parsed 296 # @throw [ParseMore] When malformed inline YAML string is parsed
Line 362... Line 363...
362 ++i 363 ++i
Line 363... Line 364...
363   364  
364 if done 365 if done
Line 365... Line 366...
365 break 366 break
Line 366... Line 367...
366   367  
367 throw new ParseException 'Malformed inline YAML string '+mapping 368 throw new ParseMore 'Malformed inline YAML string '+mapping
368   369