Java Doc for lexer.java in  » Collaboration » JacORB » org » jacorb » idl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » JacORB » org.jacorb.idl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jacorb.idl.lexer

lexer
public class lexer (Code)
This class implements a scanner (aka lexical analyzer or lexer) for IDL. The scanner reads characters from a global input stream and returns integers corresponding to the terminal number of the next token. Once the end of input is reached the EOF token is returned on every subsequent call.

All symbol constants are defined in sym.java which is generated by JavaCup from parser.cup.

In addition to the scanner proper (called first via init() then with next_token() to get each token) this class provides simple error and warning routines and keeps a count of errors and warnings that is publicly accessible. It also provides basic preprocessing facilties, i.e. it does handle preprocessor directives such as #define, #undef, #include, etc. although it does not provide full C++ preprocessing This class is "static" (i.e., it has only static members and methods).
version:
   $Id: lexer.java,v 1.53 2006/10/13 19:56:48 andre.spiegel Exp $
author:
   Gerald Brose



Field Summary
final protected static  intEOF_CHAR
     EOF constant.
protected static  Hashtablechar_symbols
     Table of single character symbols.
protected static  booleanconditionalCompilation
    
public static  StringcurrentFile
    
public static  StringcurrentPragmaPrefix
    
protected static  intcurrent_line
     Current line number for use in error messages.
protected static  intcurrent_position
     Character position in current line.
protected static  Hashtabledefines
    
static  interror_count
     Count of total errors detected so far.
protected static  booleanin_string
    
protected static  Hashtablejava_keywords
     Table of Java reserved names.
protected static  Hashtablekeywords
     Table of keywords.
protected static  Hashtablekeywords_lower_case
     Table of keywords, stored in lower case.
protected static  StringBufferline
     Current line for use in error messages.
protected static  intnext_char
     First and second character of lookahead.
protected static  intnext_char2
    
public static  intwarning_count
    
protected static  booleanwide
    


Method Summary
protected static  voidadvance()
     Advance the scanner one character in the input stream.
public static  StringcheckIdentifier(String str)
     Checks whether Identifier str is legal and returns it.
public static  intcurrentLine()
    
public static  voiddefine(String symbol, String value)
    
public static  Stringdefined(String symbol)
    
protected static  tokendo_symbol()
     Process an identifier.

Identifiers begin with a letter, underscore, or dollar sign, which is followed by zero or more letters, numbers, underscores or dollar signs.

public static  voidemit_error(String message)
     Emit an error message.
public static  voidemit_error(String message, str_token t)
    
public static  voidemit_warn(String message)
     Emit a warning message.
public static  voidemit_warn(String message, str_token t)
    
protected static  intfind_single_char(int ch)
     Try to look up a single character symbol, returns -1 for not found.
public static  PositionInfogetPosition()
    
protected static  booleanid_char(int ch)
     Determine if a character is ok for the middle of an id.
protected static  booleanid_start_char(int ch)
     Determine if a character is ok to start an id.
public static  voidinit()
     Initialize the scanner.
static  booleanisDigit(char c)
    
public static  booleanneedsJavaEscape(Module m)
    
public static  tokennext_token()
     Return one token.
protected static  voidpreprocess()
     Preprocessor directives are handled here.
protected static  tokenreal_next_token()
     The actual routine to return one token.
public static  voidreset()
    
public static  voidrestorePosition(PositionInfo p)
    
public static  booleanstrictJavaEscapeCheck(String s)
     called during the parse phase to catch clashes with Java reserved words.
protected static  voidswallow_comment()
     Handle swallowing up a comment.
public static  voidundefine(String symbol)
    

Field Detail
EOF_CHAR
final protected static int EOF_CHAR(Code)
EOF constant.



char_symbols
protected static Hashtable char_symbols(Code)
Table of single character symbols. For ease of implementation, we store all unambiguous single character tokens in this table of Integer objects keyed by Integer objects with the numerical value of the appropriate char (currently Character objects have a bug which precludes their use in tables).



conditionalCompilation
protected static boolean conditionalCompilation(Code)



currentFile
public static String currentFile(Code)
current file name



currentPragmaPrefix
public static String currentPragmaPrefix(Code)
currently active pragma prefix



current_line
protected static int current_line(Code)
Current line number for use in error messages.



current_position
protected static int current_position(Code)
Character position in current line.



defines
protected static Hashtable defines(Code)
Defined symbols (preprocessor)



error_count
static int error_count(Code)
Count of total errors detected so far.



in_string
protected static boolean in_string(Code)
Have we already read a '"' ?



java_keywords
protected static Hashtable java_keywords(Code)
Table of Java reserved names.



keywords
protected static Hashtable keywords(Code)
Table of keywords. Keywords are initially treated as identifiers. Just before they are returned we look them up in this table to see if they match one of the keywords. The string of the name is the key here, which indexes Integer objects holding the symbol number.



keywords_lower_case
protected static Hashtable keywords_lower_case(Code)
Table of keywords, stored in lower case. Keys are the lower case version of the keywords used as keys for the keywords hash above, and the values are the case sensitive versions of the keywords. This table is used for detecting collisions of identifiers with keywords.



line
protected static StringBuffer line(Code)
Current line for use in error messages.



next_char
protected static int next_char(Code)
First and second character of lookahead.



next_char2
protected static int next_char2(Code)



warning_count
public static int warning_count(Code)
Count of warnings issued so far



wide
protected static boolean wide(Code)
Are we processing a wide char or string ?





Method Detail
advance
protected static void advance() throws java.io.IOException(Code)
Advance the scanner one character in the input stream. This moves next_char2 to next_char and then reads a new next_char2.



checkIdentifier
public static String checkIdentifier(String str)(Code)
Checks whether Identifier str is legal and returns it. If the identifier is escaped with a leading underscore, that underscore is removed. If a the legal IDL identifier clashes with a Java reserved word, an underscore is prepended.

Parameters:
  str - - the IDL identifier

Prints an error msg if the identifier collides with an IDLkeyword.



currentLine
public static int currentLine()(Code)
record information about the last lexical scope so that it can be restored later



define
public static void define(String symbol, String value)(Code)



defined
public static String defined(String symbol)(Code)



do_symbol
protected static token do_symbol() throws java.io.IOException(Code)
Process an identifier.

Identifiers begin with a letter, underscore, or dollar sign, which is followed by zero or more letters, numbers, underscores or dollar signs. This routine returns a str_token suitable for return by the scanner or null, if the string that was read expanded to a symbol that was #defined. In this case, the symbol is expanded in place




emit_error
public static void emit_error(String message)(Code)
Emit an error message. The message will be marked with both the current line number and the position in the line. Error messages are printed on standard error (System.err).
Parameters:
  message - the message to print.



emit_error
public static void emit_error(String message, str_token t)(Code)



emit_warn
public static void emit_warn(String message)(Code)
Emit a warning message. The message will be marked with both the current line number and the position in the line. Messages are printed on standard error (System.err).
Parameters:
  message - the message to print.



emit_warn
public static void emit_warn(String message, str_token t)(Code)



find_single_char
protected static int find_single_char(int ch)(Code)
Try to look up a single character symbol, returns -1 for not found.
Parameters:
  ch - the character in question.



getPosition
public static PositionInfo getPosition()(Code)
return the current reading position



id_char
protected static boolean id_char(int ch)(Code)
Determine if a character is ok for the middle of an id.
Parameters:
  ch - the character in question.



id_start_char
protected static boolean id_start_char(int ch)(Code)
Determine if a character is ok to start an id.
Parameters:
  ch - the character in question.



init
public static void init() throws java.io.IOException(Code)
Initialize the scanner. This sets up the keywords and char_symbols tables and reads the first two characters of lookahead. "Object" is listed as reserved in the OMG spec. "int" is not, but I reserved it to bar its usage as a legal integer type.



isDigit
static boolean isDigit(char c)(Code)
Returns true if character is US ASCII 0-9
Parameters:
  c - a value of type 'char' a value of type 'boolean'



needsJavaEscape
public static boolean needsJavaEscape(Module m)(Code)



next_token
public static token next_token() throws java.io.IOException(Code)
Return one token. This is the main external interface to the scanner. It consumes sufficient characters to determine the next input token and returns it.



preprocess
protected static void preprocess() throws java.io.IOException(Code)
Preprocessor directives are handled here.



real_next_token
protected static token real_next_token() throws java.io.IOException(Code)
The actual routine to return one token. token
throws:
  java.io.IOException -



reset
public static void reset()(Code)
reset the scanner state



restorePosition
public static void restorePosition(PositionInfo p)(Code)



strictJavaEscapeCheck
public static boolean strictJavaEscapeCheck(String s)(Code)
called during the parse phase to catch clashes with Java reserved words.



swallow_comment
protected static void swallow_comment() throws java.io.IOException(Code)
Handle swallowing up a comment. Both old style C and new style C++ comments are handled.



undefine
public static void undefine(String symbol)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.