Class: Code::Parser::Whitespace
- Inherits:
-
Language
- Object
- Language
- Code::Parser::Whitespace
- Defined in:
- lib/code/parser/whitespace.rb
Instance Method Summary collapse
- #asterisk ⇒ Object
- #double_slash_comment ⇒ Object
- #hash_comment ⇒ Object
- #hashtag ⇒ Object
- #multi_line_comment ⇒ Object
- #newline ⇒ Object
- #root ⇒ Object
- #slash ⇒ Object
- #space ⇒ Object
- #without_newline ⇒ Object
Instance Method Details
#asterisk ⇒ Object
22 23 24 |
# File 'lib/code/parser/whitespace.rb', line 22 def asterisk str("*") end |
#double_slash_comment ⇒ Object
30 31 32 |
# File 'lib/code/parser/whitespace.rb', line 30 def double_slash_comment slash << slash << (newline.absent << any).repeat << newline.maybe end |
#hash_comment ⇒ Object
26 27 28 |
# File 'lib/code/parser/whitespace.rb', line 26 def hash_comment hashtag << (newline.absent << any).repeat << newline.maybe end |
#hashtag ⇒ Object
14 15 16 |
# File 'lib/code/parser/whitespace.rb', line 14 def hashtag str("#") end |
#multi_line_comment ⇒ Object
34 35 36 37 |
# File 'lib/code/parser/whitespace.rb', line 34 def multi_line_comment slash << asterisk << ((asterisk << slash).absent << any).repeat << asterisk.maybe << slash.maybe end |
#newline ⇒ Object
10 11 12 |
# File 'lib/code/parser/whitespace.rb', line 10 def newline str("\n") end |
#root ⇒ Object
43 44 45 46 47 48 |
# File 'lib/code/parser/whitespace.rb', line 43 def root ( space | newline | hash_comment | double_slash_comment | multi_line_comment ).repeat(1) end |
#slash ⇒ Object
18 19 20 |
# File 'lib/code/parser/whitespace.rb', line 18 def slash str("/") end |
#space ⇒ Object
6 7 8 |
# File 'lib/code/parser/whitespace.rb', line 6 def space str(" ") end |
#without_newline ⇒ Object
39 40 41 |
# File 'lib/code/parser/whitespace.rb', line 39 def without_newline (space | multi_line_comment).repeat(1) end |