Permalink
Browse files

Parse asterisks as nodes

This might need some refinement in order to satisfy #18, since sometimes
asterisks are used to represent "more history happened here, but we
don't care what exactly".
  • Loading branch information...
1 parent edaaf66 commit 5de626534c6c23f242843fabf289d16f5ab5242a @aroben committed Apr 16, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/asciidag.rb
  2. +6 −0 test/parser_test.rb
View
@@ -176,7 +176,7 @@ def self.find_parents(position, nodes_by_position, lines)
continue_search.call(:initial, position, :either).flatten
end
- NODE_REGEXP = /\w(?:\d)?['*]?/
+ NODE_REGEXP = /\w(?:\d)?['*]?|\*/
BRANCH_LABEL_REGEXP = /(?:(\w{3,}.*?)|"(.+?)"|(\(.+?\)))\s*$/
ARROW_REGEXP = /\s+(<--)\s+$/
PIXELS_PER_CHARACTER_X = 25
View
@@ -350,4 +350,10 @@
label = find_branch_label graph, '(pretend merge)'
assert_not_nil label
end
+
+ test 'should parse asterisk as node label' do
+ graph = AsciiDag.parse @graph5
+ star = find_node graph, '*'
+ assert_not_nil star
+ end
end

0 comments on commit 5de6265

Please sign in to comment.