Skip to content
This repository
Browse code

Moving parser classes into own folder

Signed-off-by: Johannes Thoenes <johannes.thoenes@googlemail.com>
  • Loading branch information...
commit 9204c9098facaf3827f10fee6027456b21c375a9 1 parent 7635369
Johannes Thönes authored December 09, 2011
17  lib/loader.rb
@@ -16,15 +16,16 @@
16 16
 require 'lib/formatting'
17 17
 require 'lib/formattings'
18 18
 
19  
-require 'lib/parser'
20  
-require 'lib/code_parser'
21  
-require 'lib/xml_parser'
22  
-require 'lib/command_node'
23  
-require 'lib/text_node'
24  
-require 'lib/formattable_text'
  19
+require 'lib/parser/base_parser'
  20
+require 'lib/parser/code_parser'
  21
+require 'lib/parser/xml_parser'
  22
+require 'lib/parser/command_node'
  23
+require 'lib/parser/text_node'
  24
+require 'lib/parser/tag_matcher'
  25
+require 'lib/parser/tag_match'
  26
+
25 27
 require 'lib/shape_formatter'
26  
-require 'lib/tag_matcher'
27  
-require 'lib/tag_match'
  28
+require 'lib/formattable_text'
28 29
 
29 30
 require 'lib/power_point'
30 31
 require 'lib/power_point/application'
2  lib/parser.rb → lib/parser/base_parser.rb
... ...
@@ -1,4 +1,4 @@
1  
-class Parser
  1
+class BaseParser
2 2
 
3 3
   TAB_WIDTH = 2
4 4
 
2  lib/code_parser.rb → lib/parser/code_parser.rb
... ...
@@ -1,4 +1,4 @@
1  
-class CodeParser < Parser
  1
+class CodeParser < BaseParser
2 2
   def pre_pattern
3 3
     /#{Regexp.escape('/*')}/
4 4
   end
0  lib/command_node.rb → lib/parser/command_node.rb
File renamed without changes
0  lib/tag_match.rb → lib/parser/tag_match.rb
File renamed without changes
0  lib/tag_matcher.rb → lib/parser/tag_matcher.rb
File renamed without changes
0  lib/text_node.rb → lib/parser/text_node.rb
File renamed without changes
2  lib/xml_parser.rb → lib/parser/xml_parser.rb
... ...
@@ -1,4 +1,4 @@
1  
-class XMLParser < Parser
  1
+class XMLParser < BaseParser
2 2
   def pre_pattern
3 3
     /#{Regexp.escape('<!--')}/
4 4
   end
6  spec/code_parser_spec.rb
... ...
@@ -1,10 +1,6 @@
1 1
 $:.unshift File.dirname($0) + '/..'
2 2
 require 'lib/loader'
3 3
 
4  
-class Parser
5  
-  public :create_ast
6  
-end
7  
-
8 4
 describe CodeParser do 
9 5
   
10 6
   describe "reference example" do
@@ -15,7 +11,7 @@ class Parser
15 11
       Formatting.create('+')
16 12
       Formatting.create('-')
17 13
       
18  
-      @root = CodeParser.new("spec-non-file", REFERENCE_EXAMPLE).create_ast
  14
+      @root = CodeParser.new("spec-non-file", REFERENCE_EXAMPLE).send(:create_ast)
19 15
     end
20 16
     
21 17
     after(:all) do

0 notes on commit 9204c90

Please sign in to comment.
Something went wrong with that request. Please try again.