Class: LanguageParser::JavaLanguageScanner
- Inherits:
-
LanguageScanner
- Object
- LanguageScanner
- LanguageParser::JavaLanguageScanner
- Defined in:
- lib/cgialib/lp/JavaLanguageScanner.rb
Overview
class : JavaLanguageScanner
This is the JavaLanguageScanner specialized to read prototypes for Java functions.
Instance Attribute Summary collapse
-
#classClass ⇒ Object
The class to use when building classes.
-
#classes ⇒ Object
readonly
An accessor for the array of classes found.
-
#javadocClass ⇒ Object
The class to use when build JavaDoc objects.
-
#prototypeClass ⇒ Object
The prototype class to build.
-
#variableClass ⇒ Object
The class to use when building variables.
Instance Method Summary collapse
-
#initialize ⇒ JavaLanguageScanner
constructor
initialize().
-
#parse(tokens) ⇒ Object
parse( tokens ).
-
#to_s ⇒ Object
to_s().
Constructor Details
#initialize ⇒ JavaLanguageScanner
initialize()
Constructs the C language scanner class
147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 147 def initialize() super() @classes = [] @prototypeClass = JavaPrototype @variableClass = JavaVariable @classClass = JavaClass @javadocClass = JavaDoc end |
Instance Attribute Details
#classClass ⇒ Object
The class to use when building classes
168 169 170 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 168 def classClass @classClass end |
#classes ⇒ Object (readonly)
An accessor for the array of classes found
162 163 164 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 162 def classes @classes end |
#javadocClass ⇒ Object
The class to use when build JavaDoc objects
164 165 166 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 164 def javadocClass @javadocClass end |
#prototypeClass ⇒ Object
The prototype class to build
160 161 162 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 160 def prototypeClass @prototypeClass end |
#variableClass ⇒ Object
The class to use when building variables
166 167 168 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 166 def variableClass @variableClass end |
Instance Method Details
#parse(tokens) ⇒ Object
parse( tokens )
tokens - An array of tokens built by a Tokenizer
This method reads the stream of tokens built by a Tokenizer and fills the @prototypes array with the prototypes that are found.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 198 def parse( tokens ) tokens.each_index { |index| if ( tokens[ index ].to_s == "class" || tokens[ index ].to_s == "interface" ) parse_class( tokens, index ) break; end } end |
#to_s ⇒ Object
to_s()
Pretty printer
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/cgialib/lp/JavaLanguageScanner.rb', line 174 def to_s() text = "" text += "Classes:\n" @classes.each { |jclass| text += jclass.to_s } text end |