Java Doc for RECompiler.java in  » J2EE » Expresso » com » jcorporate » expresso » ext » regexp » 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 » J2EE » Expresso » com.jcorporate.expresso.ext.regexp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jcorporate.expresso.ext.regexp.RECompiler

RECompiler
public class RECompiler (Code)
A regular expression compiler class. This class compiles a pattern string into a regular expression program interpretable by the RE evaluator class. The 'recompile' command line tool uses this compiler to pre-compile regular expressions for use with RE. For a description of the syntax accepted by RECompiler and what you can do with regular expressions, see the documentation for the RE matcher class.
author:
   Jonathan Locke
version:
   $Id: RECompiler.java,v 1.7 2004/11/17 20:48:15 lhamel Exp $
See Also:   RE

Inner Class :class RERange

Field Summary
final static  charESC_BACKREF
    
final static  charESC_CLASS
    
final static  charESC_COMPLEX
    
final static  charESC_MASK
    
final static  intNODE_NORMAL
    
final static  intNODE_NULLABLE
    
final static  intNODE_TOPLEVEL
    
static  int[]bracketEnd
    
final static  intbracketFinished
    
static  int[]bracketMin
    
static  int[]bracketOpt
    
static  int[]bracketStart
    
final static  intbracketUnbounded
    
static  intbrackets
    
static  HashtablehashPOSIX
    
 intidx
    
 char[]instruction
    
 intlen
    
 intlenInstruction
    
final static  intmaxBrackets
    
 intparens
    
 Stringpattern
    

Constructor Summary
public  RECompiler()
     Constructor.

Method Summary
 voidallocBrackets()
    
 intatom()
     Absorb an atomic character string.
 voidbracket()
    
 intbranch(int[] flags)
    
 intcharacterClass()
    
 intclosure(int[] flags)
    
public  REProgramcompile(String pattern)
     Compiles a regular expression pattern into a program runnable by the pattern matcher class 'RE'.
Parameters:
  pattern - Regular expression pattern to compile (see RECompiler classfor details).
 voidemit(char c)
     Emit a single character into the program stream.
 voidensure(int n)
     Ensures that n more characters can fit in the program buffer.
 charescape()
     Match an escape sequence.
 intexpr(int[] flags)
     Compile an expression with possible parens around it.
 voidinternalError()
    
 intnode(char opcode, int opdata)
    
 voidnodeInsert(char opcode, int opdata, int insertAt)
     Inserts a node with a given opcode and opdata at insertAt.
 voidsetNextOfEnd(int node, int pointTo)
    
 voidsyntaxError(String s)
    
 intterminal(int[] flags)
     Match a terminal node.

Field Detail
ESC_BACKREF
final static char ESC_BACKREF(Code)



ESC_CLASS
final static char ESC_CLASS(Code)



ESC_COMPLEX
final static char ESC_COMPLEX(Code)



ESC_MASK
final static char ESC_MASK(Code)



NODE_NORMAL
final static int NODE_NORMAL(Code)



NODE_NULLABLE
final static int NODE_NULLABLE(Code)



NODE_TOPLEVEL
final static int NODE_TOPLEVEL(Code)



bracketEnd
static int[] bracketEnd(Code)



bracketFinished
final static int bracketFinished(Code)



bracketMin
static int[] bracketMin(Code)



bracketOpt
static int[] bracketOpt(Code)



bracketStart
static int[] bracketStart(Code)



bracketUnbounded
final static int bracketUnbounded(Code)



brackets
static int brackets(Code)



hashPOSIX
static Hashtable hashPOSIX(Code)



idx
int idx(Code)



instruction
char[] instruction(Code)



len
int len(Code)



lenInstruction
int lenInstruction(Code)



maxBrackets
final static int maxBrackets(Code)



parens
int parens(Code)



pattern
String pattern(Code)




Constructor Detail
RECompiler
public RECompiler()(Code)
Constructor. Creates (initially empty) storage for a regular expression program.




Method Detail
allocBrackets
void allocBrackets()(Code)
Allocate storage for brackets only as needed



atom
int atom() throws RESyntaxException(Code)
Absorb an atomic character string. This method is a little tricky because it can un-include the last character of string if a closure operator follows. This is correct because *+? have higher precedence than concatentation (thus ABC* means AB(C*) and NOT (ABC)*). Index of new atom node
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



bracket
void bracket() throws RESyntaxException(Code)
Match bracket {m,n} expression put results in bracket member variables
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



branch
int branch(int[] flags) throws RESyntaxException(Code)
Compile one branch of an or operator (implements concatenation)
Parameters:
  flags - Flags passed by reference Pointer to branch node
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



characterClass
int characterClass() throws RESyntaxException(Code)
Compile a character class Index of class node
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



closure
int closure(int[] flags) throws RESyntaxException(Code)
Compile a possibly closured terminal
Parameters:
  flags - Flags passed by reference Index of closured node
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



compile
public REProgram compile(String pattern) throws RESyntaxException(Code)
Compiles a regular expression pattern into a program runnable by the pattern matcher class 'RE'.
Parameters:
  pattern - Regular expression pattern to compile (see RECompiler classfor details). A compiled regular expression program.
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.
See Also:   RECompiler
See Also:   RE



emit
void emit(char c)(Code)
Emit a single character into the program stream.
Parameters:
  c - Character to add



ensure
void ensure(int n)(Code)
Ensures that n more characters can fit in the program buffer. If n more can't fit, then the size is doubled until it can.
Parameters:
  n - Number of additional characters to ensure will fit.



escape
char escape() throws RESyntaxException(Code)
Match an escape sequence. Handles quoted chars and octal escapes as well as normal escape characters. Always advances the input stream by the right amount. This code "understands" the subtle difference between an octal escape and a backref. You can access the type of ESC_CLASS or ESC_COMPLEX or ESC_BACKREF by looking at pattern[idx - 1]. ESC_* code or character if simple escape
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



expr
int expr(int[] flags) throws RESyntaxException(Code)
Compile an expression with possible parens around it. Paren matching is done at this level so we can tie the branch tails together.
Parameters:
  flags - Flag value passed by reference Node index of expression in instruction array
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



internalError
void internalError() throws Error(Code)
Throws a new internal error exception
throws:
  Error - Thrown in the event of an internal error.



node
int node(char opcode, int opdata)(Code)
Adds a new node
Parameters:
  opcode - Opcode for node
Parameters:
  opdata - Opdata for node (only the low 16 bits are currently used) Index of new node in program



nodeInsert
void nodeInsert(char opcode, int opdata, int insertAt)(Code)
Inserts a node with a given opcode and opdata at insertAt. The node relative next pointer is initialized to 0.
Parameters:
  opcode - Opcode for new node
Parameters:
  opdata - Opdata for new node (only the low 16 bits are currently used)
Parameters:
  insertAt - Index at which to insert the new node in the program



setNextOfEnd
void setNextOfEnd(int node, int pointTo)(Code)
Appends a node to the end of a node chain
Parameters:
  node - Start of node chain to traverse
Parameters:
  pointTo - Node to have the tail of the chain point to



syntaxError
void syntaxError(String s) throws RESyntaxException(Code)
Throws a new syntax error exception
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



terminal
int terminal(int[] flags) throws RESyntaxException(Code)
Match a terminal node.
Parameters:
  flags - Flags Index of terminal node (closeable)
throws:
  RESyntaxException - Thrown if the regular expression has invalid syntax.



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.