RbYAML 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/lib/rbyaml.rb +14 -256
  2. data/lib/rbyaml.rb.~1.2.~ +383 -0
  3. data/lib/rbyaml/composer.rb +9 -11
  4. data/lib/rbyaml/{composer.rb.~1.2.~ → composer.rb.~1.3.~} +28 -25
  5. data/lib/rbyaml/constants.rb +95 -0
  6. data/lib/rbyaml/constructor.rb +180 -89
  7. data/lib/rbyaml/{constructor.rb.~1.2.~ → constructor.rb.~1.9.~} +137 -95
  8. data/lib/rbyaml/dumper.rb +12 -9
  9. data/lib/rbyaml/dumper.rb.~1.3.~ +36 -0
  10. data/lib/rbyaml/emitter.rb +14 -28
  11. data/lib/rbyaml/{emitter.rb.~1.2.~ → emitter.rb.~1.6.~} +22 -33
  12. data/lib/rbyaml/error.rb +4 -57
  13. data/lib/rbyaml/error.rb.~1.2.~ +75 -0
  14. data/lib/rbyaml/events.rb +8 -14
  15. data/lib/rbyaml/{events.rb.~1.2.~ → events.rb.~1.4.~} +29 -6
  16. data/lib/rbyaml/nodes.rb +5 -5
  17. data/lib/rbyaml/{nodes.rb.~1.2.~ → nodes.rb.~1.3.~} +13 -9
  18. data/lib/rbyaml/parser.rb +70 -108
  19. data/lib/rbyaml/parser.rb.~1.4.~ +632 -0
  20. data/lib/rbyaml/representer.rb +19 -157
  21. data/lib/rbyaml/representer.rb.old +317 -0
  22. data/lib/rbyaml/{representer.rb.~1.2.~ → representer.rb.~1.5.~} +60 -26
  23. data/lib/rbyaml/resolver.rb +6 -6
  24. data/lib/rbyaml/{resolver.rb.~1.1.~ → resolver.rb.~1.6.~} +20 -20
  25. data/lib/rbyaml/rubytypes.rb +391 -0
  26. data/lib/rbyaml/scanner.rb +123 -225
  27. data/lib/rbyaml/{scanner.rb.~1.2.~ → scanner.rb.~1.5.~} +466 -378
  28. data/lib/rbyaml/serializer.rb +9 -9
  29. data/lib/rbyaml/{serializer.rb.~1.2.~ → serializer.rb.~1.4.~} +19 -17
  30. data/lib/rbyaml/stream.rb +48 -0
  31. data/lib/rbyaml/tag.rb +72 -0
  32. data/lib/rbyaml/tokens.rb +22 -16
  33. data/lib/rbyaml/{tokens.rb.~1.2.~ → tokens.rb.~1.3.~} +44 -4
  34. data/lib/rbyaml/types.rb +146 -0
  35. data/lib/rbyaml/util.rb.~1.3.~ +38 -0
  36. data/lib/rbyaml/yaml.rb +22 -32
  37. data/lib/rbyaml/{yaml.rb.~1.2.~ → yaml.rb.~1.5.~} +17 -17
  38. data/test/load_one.rb +6 -0
  39. data/test/load_one_yaml.rb +6 -0
  40. data/test/output_events.rb +9 -0
  41. data/test/test_add_ctor.rb +51 -0
  42. data/test/test_add_ctor.rb.~1.1.~ +30 -0
  43. data/test/test_bm.rb +2 -2
  44. data/test/test_bm.rb.~1.1.~ +28 -0
  45. data/test/test_gems.rb +10 -0
  46. data/test/test_one.rb.~1.1.~ +5 -0
  47. data/test/test_one_syck.rb +5 -0
  48. data/test/test_rbyaml.rb +63 -32
  49. data/test/test_rbyaml.rb.~1.6.~ +59 -0
  50. data/test/{test_rbyaml.rb.~1.2.~ → test_rbyaml_old.rb} +13 -4
  51. data/test/test_time_events.rb +24 -0
  52. data/test/test_time_nodes.rb +24 -0
  53. data/test/test_time_tokens.rb +24 -0
  54. data/test/yaml/gems_new.yml +147456 -0
  55. data/test/yaml/test1.rb +8 -0
  56. data/test/yaml/test10.rb +14 -0
  57. data/test/yaml/test11.rb +13 -0
  58. data/test/yaml/test12.rb +9 -0
  59. data/test/yaml/test13.rb +9 -0
  60. data/test/yaml/test14.rb +13 -0
  61. data/test/yaml/test15.rb +12 -0
  62. data/test/yaml/test16.rb +11 -0
  63. data/test/yaml/test16.rb.~1.1.~ +11 -0
  64. data/test/yaml/test17.rb +10 -0
  65. data/test/yaml/test18.rb +13 -0
  66. data/test/yaml/test19.rb +9 -0
  67. data/test/yaml/test19.yml +1 -1
  68. data/test/yaml/test2.rb +8 -0
  69. data/test/yaml/test20.rb +11 -0
  70. data/test/yaml/test20.rb.~1.1.~ +9 -0
  71. data/test/yaml/test20.yml +1 -1
  72. data/test/yaml/test3.rb +13 -0
  73. data/test/yaml/test4.rb +13 -0
  74. data/test/yaml/test5.rb +8 -0
  75. data/test/yaml/test6.rb +10 -0
  76. data/test/yaml/test7.rb +15 -0
  77. data/test/yaml/test8.rb +15 -0
  78. data/test/yaml/test9.rb +13 -0
  79. metadata +61 -16
  80. data/lib/rbyaml/dumper.rb.~1.2.~ +0 -43
  81. data/lib/rbyaml/parser.rb.~1.2.~ +0 -494
@@ -0,0 +1,36 @@
1
+ require 'rbyaml/emitter'
2
+ require 'rbyaml/serializer'
3
+ require 'rbyaml/representer'
4
+ require 'rbyaml/resolver'
5
+
6
+ module RbYAML
7
+ class CommonDumper
8
+ attr_accessor :emitter, :serializer, :representer, :resolver
9
+ def initialize(stream,default_style=nil,default_flow_style=nil,canonical=nil,indent=nil,width=nil,line_break=nil,explicit_start=nil,explicit_end=nil,version=nil,tags=nil,emitter=Emitter,serializer=Serializer,representer=Representer,resolver=Resolver)
10
+ super()
11
+ @emitter = emitter.new(stream,canonical,indent,width,line_break)
12
+ @resolver = resolver.new
13
+ @serializer = serializer.new(@emitter,@resolver,explicit_start,explicit_end,version,tags)
14
+ @representer = representer.new(@serializer,default_style,default_flow_style)
15
+ end
16
+ end
17
+
18
+ class BaseDumper < CommonDumper
19
+ attr_accessor
20
+ def initialize(stream,default_style=nil,default_flow_style=nil,canonical=nil,indent=nil,width=nil,line_break=nil,explicit_start=nil,explicit_end=nil,version=nil,tags=nil,emitter=Emitter,serializer=Serializer,representer=BaseRepresenter,resolver=BaseResolver)
21
+ super
22
+ end
23
+ end
24
+
25
+ class SafeDumper < CommonDumper
26
+ def initialize(stream,default_style=nil,default_flow_style=nil,canonical=nil,indent=nil,width=nil,line_break=nil,explicit_start=nil,explicit_end=nil,version=nil,tags=nil,emitter=Emitter,serializer=Serializer,representer=SafeRepresenter,resolver=Resolver)
27
+ super
28
+ end
29
+ end
30
+
31
+ class Dumper < CommonDumper
32
+ def initialize(stream,default_style=nil,default_flow_style=nil,canonical=nil,indent=nil,width=nil,line_break=nil,explicit_start=nil,explicit_end=nil,version=nil,tags=nil,emitter=Emitter,serializer=Serializer,representer=Representer,resolver=Resolver)
33
+ super
34
+ end
35
+ end
36
+ end
@@ -20,9 +20,10 @@ module RbYAML
20
20
  "tag:yaml.org,2002:" => "!!"
21
21
  }
22
22
 
23
- def initialize(stream, canonical=nil, indent=nil, width=nil,line_break=nil)
23
+ def initialize(stream, opts={})
24
24
  # The stream should have the methods `write` and possibly `flush`.
25
25
  @stream = stream
26
+ @options = opts
26
27
 
27
28
  # Emitter is a state machine with a stack of states to handle nested
28
29
  # structures.
@@ -57,15 +58,14 @@ module RbYAML
57
58
  @indention = true
58
59
 
59
60
  # Formatting details.
60
- @canonical = canonical
61
+ @canonical = opts[:Canonical]
61
62
  @best_indent = 2
62
- @best_indent = indent if indent && indent!=0 && 1 < indent && indent < 10
63
+ @best_indent = opts[:Indent] if 2...10 === opts[:Indent]
63
64
 
64
65
  @best_width = 80
65
- @best_width = width if width && width != 0 && width > @best_indent*2
66
+ @best_width = opts[:BestWidth] if opts[:BestWidth] != 0 && opts[:BestWidth] > @best_indent*2
66
67
 
67
68
  @best_line_break = "\n"
68
- @best_line_break = line_break if ["\r", "\n", "\r\n"].include?(line_break)
69
69
 
70
70
  # Tag prefixes.
71
71
  @tag_prefixes = nil
@@ -178,7 +178,7 @@ module RbYAML
178
178
  implicit = first && !@event.explicit && !@canonical && !@event.version && !@event.tags && !check_empty_document
179
179
  if !implicit
180
180
  write_indent
181
- write_indicator("---",true)
181
+ write_indicator("--- ",true,true)
182
182
  if @canonical
183
183
  write_indent
184
184
  end
@@ -349,14 +349,14 @@ module RbYAML
349
349
  end
350
350
 
351
351
  def expect_flow_mapping_simple_value
352
- write_indicator(":", false)
352
+ write_indicator(": ", false,true)
353
353
  @states << :expect_flow_mapping_key
354
354
  expect_node(false,false,true)
355
355
  end
356
356
 
357
357
  def expect_flow_mapping_value
358
358
  write_indent if @canonical || @column > @best_width
359
- write_indicator(":", true)
359
+ write_indicator(": ", false,true)
360
360
  @states << :expect_flow_mapping_key
361
361
  expect_node(false,false,true)
362
362
  end
@@ -414,14 +414,14 @@ module RbYAML
414
414
  end
415
415
 
416
416
  def expect_block_mapping_simple_value
417
- write_indicator(":", false)
417
+ write_indicator(": ", false,true)
418
418
  @states << :expect_block_mapping_key
419
419
  expect_node(false,false,true)
420
420
  end
421
421
 
422
422
  def expect_block_mapping_value
423
423
  write_indent
424
- write_indicator(":",true,false,true)
424
+ write_indicator(": ",true,true,true)
425
425
  @states << :expect_block_mapping_key
426
426
  expect_node(false,false,true)
427
427
  end
@@ -506,7 +506,6 @@ module RbYAML
506
506
  return ""
507
507
  end
508
508
  end
509
-
510
509
  if !@event.style && @event.implicit && (!(@simple_key_context && (@analysis.empty || @analysis.multiline)) &&
511
510
  (@flow_level!=0 && @analysis.allow_flow_plain || (@flow_level==0 && @analysis.allow_block_plain)))
512
511
  return ""
@@ -758,6 +757,10 @@ module RbYAML
758
757
  # allowed for double quoted scalars.
759
758
  allow_flow_plain = allow_block_plain = allow_single_quoted = allow_block = false if mixed_breaks_spaces || special_characters
760
759
 
760
+ # This seem to have been missed...
761
+ allow_flow_plain = allow_block_plain = allow_single_quoted = false if inline_breaks
762
+ allow_single_quoted = false if trailing_breaks
763
+
761
764
  # We don't emit multiline plain scalars.
762
765
  allow_flow_plain = allow_block_plain = false if line_breaks
763
766
 
@@ -852,7 +855,6 @@ module RbYAML
852
855
  end
853
856
  elsif breaks
854
857
  if ch.nil? or !"\n\x85".include?(ch)
855
- write_line_break if text[start] == ?\n
856
858
  (text[start...ending]).each_byte { |br|
857
859
  if br == ?\n
858
860
  write_line_break
@@ -890,22 +892,6 @@ module RbYAML
890
892
  write_indicator("'", false)
891
893
  end
892
894
 
893
- ESCAPE_REPLACEMENTS = {
894
- ?\0 => "0",
895
- ?\x07 => "a",
896
- ?\x08 => "b",
897
- ?\x09 => "t",
898
- ?\x0A => "n",
899
- ?\x0B => "v",
900
- ?\x0C => "f",
901
- ?\x0D => "r",
902
- ?\x1B => "e",
903
- ?" => "\"",
904
- ?\\ => "\\",
905
- ?\x85 => "N",
906
- ?\xA0 => "_"
907
- }
908
-
909
895
  def write_double_quoted(text, split=true)
910
896
  write_indicator('"', true)
911
897
  start = ending = 0
@@ -12,27 +12,15 @@ module RbYAML
12
12
  class EmitterError < YAMLError
13
13
  end
14
14
 
15
- class ScalarAnalysis
16
- attr_accessor :scalar,:empty,:multiline,:allow_flow_plain,:allow_block_plain,:allow_single_quoted,:allow_double_quoted,:allow_block
17
- def initialize(scalar,empty,multiline,allow_flow_plain, allow_block_plain,allow_single_quoted, allow_double_quoted,allow_block)
18
- @scalar = scalar
19
- @empty = empty
20
- @multiline = multiline
21
- @allow_flow_plain = allow_flow_plain
22
- @allow_block_plain = allow_block_plain
23
- @allow_single_quoted = allow_single_quoted
24
- @allow_double_quoted = allow_double_quoted
25
- @allow_block = allow_block
26
- end
27
- end
15
+ ScalarAnalysis = Struct.new(:scalar,:empty,:multiline,:allow_flow_plain,:allow_block_plain,:allow_single_quoted,:allow_double_quoted,:allow_block)
28
16
 
29
- module Emitter
17
+ class Emitter
30
18
  DEFAULT_TAG_PREFIXES = {
31
19
  "!" => "!",
32
20
  "tag:yaml.org,2002:" => "!!"
33
21
  }
34
22
 
35
- def initialize_emitter(stream, canonical=nil, indent=nil, width=nil,line_break=nil)
23
+ def initialize(stream, canonical=nil, indent=nil, width=nil,line_break=nil)
36
24
  # The stream should have the methods `write` and possibly `flush`.
37
25
  @stream = stream
38
26
 
@@ -190,7 +178,7 @@ module RbYAML
190
178
  implicit = first && !@event.explicit && !@canonical && !@event.version && !@event.tags && !check_empty_document
191
179
  if !implicit
192
180
  write_indent
193
- write_indicator("---",true)
181
+ write_indicator("--- ",true,true)
194
182
  if @canonical
195
183
  write_indent
196
184
  end
@@ -361,14 +349,14 @@ module RbYAML
361
349
  end
362
350
 
363
351
  def expect_flow_mapping_simple_value
364
- write_indicator(":", false)
352
+ write_indicator(": ", false,true)
365
353
  @states << :expect_flow_mapping_key
366
354
  expect_node(false,false,true)
367
355
  end
368
356
 
369
357
  def expect_flow_mapping_value
370
358
  write_indent if @canonical || @column > @best_width
371
- write_indicator(":", true)
359
+ write_indicator(": ", false,true)
372
360
  @states << :expect_flow_mapping_key
373
361
  expect_node(false,false,true)
374
362
  end
@@ -426,14 +414,14 @@ module RbYAML
426
414
  end
427
415
 
428
416
  def expect_block_mapping_simple_value
429
- write_indicator(":", false)
417
+ write_indicator(": ", false,true)
430
418
  @states << :expect_block_mapping_key
431
419
  expect_node(false,false,true)
432
420
  end
433
421
 
434
422
  def expect_block_mapping_value
435
423
  write_indent
436
- write_indicator(":",true,false,true)
424
+ write_indicator(": ",true,true,true)
437
425
  @states << :expect_block_mapping_key
438
426
  expect_node(false,false,true)
439
427
  end
@@ -441,36 +429,35 @@ module RbYAML
441
429
  # Checkers.
442
430
 
443
431
  def check_empty_sequence
444
- SequenceStartEvent === @event && !@events.empty? && SequenceEndEvent === @events.first
432
+ @event.__is_sequence_start && !@events.empty? && @events.first.__is_sequence_end
445
433
  end
446
434
 
447
435
  def check_empty_mapping
448
- MappingStartEvent === @event && !@events.empty? && MappingEndEvent === @events.first
436
+ @event.__is_mapping_start && !@events.empty? && @events.first.__is_mapping_end
449
437
  end
450
438
 
451
439
  def check_empty_document
452
- return false if !DocumentStartEvent === @event || @events.empty?
440
+ return false if !@event.__is_document_start || @events.empty?
453
441
  event = @events.first
454
- ScalarEvent === event && event.anchor.nil? && event.tag.nil? && event.implicit && event.value == ""
442
+ event.__is_scalar && event.anchor.nil? && event.tag.nil? && event.implicit && event.value == ""
455
443
  end
456
444
 
457
445
  def check_simple_key
458
446
  length = 0
459
- if NodeEvent === @event && !@event.anchor.nil?
447
+ if @event.__is_node && !@event.anchor.nil?
460
448
  @prepared_anchor = prepare_anchor(@event.anchor) if @prepared_anchor.nil?
461
449
  length += @prepared_anchor.length
462
450
  end
463
- if (ScalarEvent === @event || CollectionStartEvent === @event) && !@event.tag.nil?
451
+ if (@event.__is_scalar || @event.__is_collection_start) && !@event.tag.nil?
464
452
  @prepared_tag = prepare_tag(@event.tag) if @prepared_tag.nil?
465
453
  length += @prepared_tag.length
466
454
  end
467
- if ScalarEvent === @event
455
+ if @event.__is_scalar
468
456
  @analysis = analyze_scalar(@event.value) if @analysis.nil?
469
457
  length += @analysis.scalar.length
470
458
  end
471
459
 
472
- (length < 128 && (AliasEvent === @event ||
473
- (ScalarEvent === @event && !@analysis.empty && !@analysis.multiline) ||
460
+ (length < 128 && (@event.__is_alias || (@event.__is_scalar && !@analysis.empty && !@analysis.multiline) ||
474
461
  check_empty_sequence || check_empty_mapping))
475
462
  end
476
463
 
@@ -519,7 +506,6 @@ module RbYAML
519
506
  return ""
520
507
  end
521
508
  end
522
-
523
509
  if !@event.style && @event.implicit && (!(@simple_key_context && (@analysis.empty || @analysis.multiline)) &&
524
510
  (@flow_level!=0 && @analysis.allow_flow_plain || (@flow_level==0 && @analysis.allow_block_plain)))
525
511
  return ""
@@ -570,7 +556,7 @@ module RbYAML
570
556
  ending = 1 if prefix[0] == ?!
571
557
  ending += 1 while ending < prefix.length
572
558
  chunks << prefix[start...ending] if start < ending
573
- chunks.join("")
559
+ chunks.to_s
574
560
  end
575
561
 
576
562
  def prepare_tag(tag)
@@ -588,7 +574,7 @@ module RbYAML
588
574
  start = ending = 0
589
575
  ending += 1 while ending < suffix.length
590
576
  chunks << suffix[start...ending] if start < ending
591
- suffix_text = chunks.join("")
577
+ suffix_text = chunks.to_s
592
578
  if handle
593
579
  "#{handle}#{suffix_text}"
594
580
  else
@@ -771,6 +757,10 @@ module RbYAML
771
757
  # allowed for double quoted scalars.
772
758
  allow_flow_plain = allow_block_plain = allow_single_quoted = allow_block = false if mixed_breaks_spaces || special_characters
773
759
 
760
+ # This seem to have been missed...
761
+ allow_flow_plain = allow_block_plain = allow_single_quoted = false if inline_breaks
762
+ allow_single_quoted = false if trailing_breaks
763
+
774
764
  # We don't emit multiline plain scalars.
775
765
  allow_flow_plain = allow_block_plain = false if line_breaks
776
766
 
@@ -865,7 +855,6 @@ module RbYAML
865
855
  end
866
856
  elsif breaks
867
857
  if ch.nil? or !"\n\x85".include?(ch)
868
- write_line_break if text[start] == ?\n
869
858
  (text[start...ending]).each_byte { |br|
870
859
  if br == ?\n
871
860
  write_line_break
@@ -1,75 +1,22 @@
1
1
 
2
2
  module RbYAML
3
- Mark = Struct.new(:name,:column,:buffer,:pointer)
4
- class Mark
5
- def get_snippet(indent=4, max_length=75)
6
- return nil if buffer.nil?
7
- head = ""
8
- start = pointer
9
- while start > 0 && !"\0\r\n\x85".include?(buffer[start-1])
10
- start -= 1
11
- if pointer-start > max_length/2-1
12
- head = " ... "
13
- start += 5
14
- break
15
- end
16
- end
17
- tail = ""
18
- tend = pointer
19
- while tend < buffer.length && !"\0\r\n\x85".include?(buffer[tend])
20
- tend += 1
21
- if tend-pointer > max_length/2-1
22
- tail = " ... "
23
- tend -= 5
24
- break
25
- end
26
- end
27
- snippet = buffer[start..tend]
28
- ' ' * indent + "#{head}#{snippet}#{tail}\n" + ' '*(indent+pointer-start+head.length) + ' '
29
- end
30
-
31
- def to_s
32
- snippet = get_snippet()
33
- where = " in \"#{name}\", line ?, column #{column+1}"
34
- if snippet
35
- where << ":\n" << snippet
36
- end
37
- end
38
-
39
- def hash
40
- object_id
41
- end
42
- end
43
-
44
3
  class YAMLError < StandardError
45
- end
46
-
47
- class TypeError < YAMLError
48
- end
49
-
50
- class MarkedYAMLError < YAMLError
51
- def initialize(context=nil, context_mark=nil, problem=nil, problem_mark=nil, note=nil)
4
+ def initialize(context=nil, problem=nil, note=nil)
52
5
  super()
53
6
  @context = context
54
- @context_mark = context_mark
55
7
  @problem = problem
56
- @problem_mark = problem_mark
57
8
  @note = note
58
9
  end
59
10
 
60
11
  def to_s
61
12
  lines = []
62
-
63
13
  lines << @context if @context
64
- if @context_mark && (@problem.nil? || @problem_mark.nil? ||
65
- @context_mark.name != @problem_mark.name ||
66
- @context_mark.column != @problem_mark.column)
67
- lines << @context_mark.to_s
68
- end
69
14
  lines << @problem if @problem
70
- lines << @problem_mark.to_s if @problem_mark
71
15
  lines << @note if @note
72
16
  lines.join("\n")
73
17
  end
74
18
  end
19
+
20
+ class TypeError < YAMLError
21
+ end
75
22
  end
@@ -0,0 +1,75 @@
1
+
2
+ module RbYAML
3
+ Mark = Struct.new(:name,:column,:buffer,:pointer)
4
+ class Mark
5
+ def get_snippet(indent=4, max_length=75)
6
+ return nil if buffer.nil?
7
+ head = ""
8
+ start = pointer
9
+ while start > 0 && !"\0\r\n\x85".include?(buffer[start-1])
10
+ start -= 1
11
+ if pointer-start > max_length/2-1
12
+ head = " ... "
13
+ start += 5
14
+ break
15
+ end
16
+ end
17
+ tail = ""
18
+ tend = pointer
19
+ while tend < buffer.length && !"\0\r\n\x85".include?(buffer[tend])
20
+ tend += 1
21
+ if tend-pointer > max_length/2-1
22
+ tail = " ... "
23
+ tend -= 5
24
+ break
25
+ end
26
+ end
27
+ snippet = buffer[start..tend]
28
+ ' ' * indent + "#{head}#{snippet}#{tail}\n" + ' '*(indent+pointer-start+head.length) + ' '
29
+ end
30
+
31
+ def to_s
32
+ snippet = get_snippet()
33
+ where = " in \"#{name}\", line ?, column #{column+1}"
34
+ if snippet
35
+ where << ":\n" << snippet
36
+ end
37
+ end
38
+
39
+ def hash
40
+ object_id
41
+ end
42
+ end
43
+
44
+ class YAMLError < StandardError
45
+ end
46
+
47
+ class TypeError < YAMLError
48
+ end
49
+
50
+ class MarkedYAMLError < YAMLError
51
+ def initialize(context=nil, context_mark=nil, problem=nil, problem_mark=nil, note=nil)
52
+ super()
53
+ @context = context
54
+ @context_mark = context_mark
55
+ @problem = problem
56
+ @problem_mark = problem_mark
57
+ @note = note
58
+ end
59
+
60
+ def to_s
61
+ lines = []
62
+
63
+ lines << @context if @context
64
+ if @context_mark && (@problem.nil? || @problem_mark.nil? ||
65
+ @context_mark.name != @problem_mark.name ||
66
+ @context_mark.column != @problem_mark.column)
67
+ lines << @context_mark.to_s
68
+ end
69
+ lines << @problem if @problem
70
+ lines << @problem_mark.to_s if @problem_mark
71
+ lines << @note if @note
72
+ lines.join("\n")
73
+ end
74
+ end
75
+ end