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
122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/gettext/tools/parser/ruby.rb', line 122 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
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 107 108 109 110 111 112 113 114 115 |
# File 'lib/gettext/tools/parser/ruby.rb', line 81 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 |