Class: GetText::RubyLexX
- Inherits:
-
RubyLex
- Object
- RubyLex
- GetText::RubyLexX
- Defined in:
- lib/gettext/tools/parser/ruby.rb
Overview
:nodoc: all
Defined Under Namespace
Classes: StringExtractor
Instance Method Summary collapse
- #identify_comment ⇒ Object
-
#parse ⇒ Object
Parser#parse resemlbes RubyLex#lex.
Instance Method Details
#identify_comment ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/gettext/tools/parser/ruby.rb', line 113 def identify_comment @ltype = "#" get_readed # skip the hash sign itself while ch = getc if ch == "\n" @ltype = nil ungetc break end end return Token(TkCOMMENT_WITH_CONTENT, get_readed) end |
#parse ⇒ Object
Parser#parse resemlbes RubyLex#lex
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/gettext/tools/parser/ruby.rb', line 72 def parse until ( (tk = token).kind_of?(RubyToken::TkEND_OF_SCRIPT) && !@continue or tk.nil? ) s = get_readed if RubyToken::TkSTRING === tk or RubyToken::TkDSTRING === tk def tk.value @value end def tk.value=(s) @value = s end if @here_header s = s.sub(/\A.*?\n/, "").sub(/^.*\n\Z/, "") else s = StringExtractor.new(s).parse("") end tk.value = s end if $DEBUG if tk.is_a? TkSTRING or tk.is_a? TkDSTRING $stderr.puts("#{tk}: #{tk.value}") elsif tk.is_a? TkIDENTIFIER $stderr.puts("#{tk}: #{tk.name}") else $stderr.puts(tk) end end yield tk end return nil end |