Package com.sun.tools.corba.ee.idl
Class PragmaHandler
java.lang.Object
com.sun.tools.corba.ee.idl.PragmaHandler
- Direct Known Subclasses:
MetaPragma
,NoPragma
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
closeScope
(SymtabEntry entry) This method is called when the parser encounters a right curly brace.protected String
Get the current token.protected SymtabEntry
getEntryForName
(String string) This method, given an entry name, returns the entry with that name.protected String
This method returns a string of all of the characters from the input file from the current position up to, but not including, the end-of-line character(s).protected String
getUntil
(char c) This method returns a string of all of the characters from the input file from the current position up to, but not including, the given character.(package private) void
init
(Preprocessor p) protected String
This method returns the next token String from the input file.protected void
openScope
(SymtabEntry entry) This method is called when the parser encounters a left curly brace.protected void
parseException
(String message) This method displays a Parser Exception complete with line number and position information with the given message string.abstract boolean
protected SymtabEntry
This method assumes that the current token marks the beginning of a scoped name.protected void
Skip to the end of the line.protected String
skipUntil
(char c) This method skips the data in the input file until the specified character is encountered, then it returns the next token.
-
Field Details
-
preprocessor
-
-
Constructor Details
-
PragmaHandler
public PragmaHandler()
-
-
Method Details
-
process
- Throws:
IOException
-
init
-
currentToken
Get the current token.- Returns:
- the current token
-
getEntryForName
This method, given an entry name, returns the entry with that name. It can take fully or partially qualified names and returns the appropriate entry defined within the current scope. If no entry exists, null is returned.- Parameters:
string
- entry name to look for- Returns:
- entry with that name or
null
if no entry
-
getStringToEOL
This method returns a string of all of the characters from the input file from the current position up to, but not including, the end-of-line character(s).- Returns:
- String from current position
- Throws:
IOException
-
getUntil
This method returns a string of all of the characters from the input file from the current position up to, but not including, the given character. It encapsulates parenthesis and quoted strings, meaning it does not stop if the given character is found within parentheses or quotes. For instance, given the input of `start(inside)end', getUntil ('n') will return "start(inside)e".- Parameters:
c
- token to read up to. The token itself will not be read.- Throws:
IOException
-
nextToken
This method returns the next token String from the input file.- Returns:
- the next token String
- Throws:
IOException
-
scopedName
This method assumes that the current token marks the beginning of a scoped name. It then parses the subsequent identifier and double colon tokens, builds the scoped name, and finds the symbol table entry with that name.- Returns:
- a SymtabEntry of the name
- Throws:
IOException
-
skipToEOL
Skip to the end of the line.- Throws:
IOException
-
skipUntil
This method skips the data in the input file until the specified character is encountered, then it returns the next token.- Parameters:
c
- token to indicate end of skipping- Throws:
IOException
-
parseException
This method displays a Parser Exception complete with line number and position information with the given message string.- Parameters:
message
- message to display as part of the Exception- See Also:
-
openScope
This method is called when the parser encounters a left curly brace. An extender of PragmaHandler may find scope information useful. For example, the prefix pragma takes effect as soon as it is encountered and stays in effect until the current scope is closed. If a similar pragma extension is desired, then the openScope and closeScope methods are available for overriding.- Parameters:
entry
- the symbol table entry whose scope has just been opened. Be aware that, since the scope has just been entered, this entry is incomplete at this point.
-
closeScope
This method is called when the parser encounters a right curly brace. An extender of PragmaHandler may find scope information useful. For example, the prefix pragma takes effect as soon as it is encountered and stays in effect until the current scope is closed. If a similar pragma extension is desired, then the openScope and closeScope methods are available for overriding.- Parameters:
entry
- the symbol table entry whose scope has just been closed.
-