Java Doc for AwkCompiler.java in  » Library » jakarta-oro-2.0.8 » org » apache » oro » text » awk » 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 » Library » jakarta oro 2.0.8 » org.apache.oro.text.awk 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.oro.text.awk.AwkCompiler

AwkCompiler
final public class AwkCompiler implements PatternCompiler(Code)
The AwkCompiler class is used to create compiled regular expressions conforming to the Awk regular expression syntax. It generates AwkPattern instances upon compilation to be used in conjunction with an AwkMatcher instance. AwkMatcher finds true leftmost-longest matches, so you must take care with how you formulate your regular expression to avoid matching more than you really want.

The supported regular expression syntax is a superset of traditional AWK, but NOT to be confused with GNU AWK or other AWK variants. Additionally, this AWK implementation is DFA-based and only supports 8-bit ASCII. Consequently, these classes can perform very fast pattern matches in most cases.

This is the traditional Awk syntax that is supported:

  • Alternatives separated by |
  • Quantified atoms
    *
    Match 0 or more times.
    +
    Match 1 or more times.
    ?
    Match 0 or 1 times.
  • Atoms
    • regular expression within parentheses
    • a . matches everything including newline
    • a ^ is a null token matching the beginning of a string but has no relation to newlines (and is only valid at the beginning of a regex; this differs from traditional awk for the sake of efficiency in Java).
    • a $ is a null token matching the end of a string but has no relation to newlines (and is only valid at the end of a regex; this differs from traditional awk for the sake of efficiency in Java).
    • Character classes (e.g., [abcd]) and ranges (e.g. [a-z])
      • Special backslashed characters work within a character class
    • Special backslashed characters
      \b
      backspace
      \n
      newline
      \r
      carriage return
      \t
      tab
      \f
      formfeed
      \xnn
      hexadecimal representation of character
      \nn or \nnn
      octal representation of character
      Any other backslashed character matches itself

This is the extended syntax that is supported:

  • Quantified atoms
    {n,m}
    Match at least n but not more than m times.
    {n,}
    Match at least n times.
    {n}
    Match exactly n times.
  • Atoms
    • Special backslashed characters
      \d
      digit [0-9]
      \D
      non-digit [^0-9]
      \w
      word character [0-9a-z_A-Z]
      \W
      a non-word character [^0-9a-z_A-Z]
      \s
      a whitespace character [ \t\n\r\f]
      \S
      a non-whitespace character [^ \t\n\r\f]
      \cD
      matches the corresponding control character
      \0
      matches null character

version:
   @version@
since:
   1.0
See Also:   org.apache.oro.text.regex.PatternCompiler
See Also:   org.apache.oro.text.regex.MalformedPatternException
See Also:   AwkPattern
See Also:   AwkMatcher


Field Summary
final public static  intCASE_INSENSITIVE_MASK
     A mask passed as an option to the AwkCompiler.compile compile methods to indicate a compiled regular expression should be case insensitive.
final public static  intDEFAULT_MASK
     The default mask for the AwkCompiler.compile compile methods.
final public static  intMULTILINE_MASK
     A mask passed as an option to the AwkCompiler.compile compile methods to indicate a compiled regular expression should treat input as having multiple lines.
final static  char_END_OF_INPUT
    


Method Summary
static  boolean_isLowerCase(char token)
    
static  boolean_isUpperCase(char token)
    
static  boolean_isWordCharacter(char token)
    
 SyntaxNode_newTokenNode(char token, int position)
    
 SyntaxTree_parse(char[] expression)
    
static  char_toggleCase(char token)
    
public  Patterncompile(char[] pattern, int options)
     Compiles an Awk regular expression into an AwkPattern instance that can be used by an AwkMatcher object to perform pattern matching.


Parameters:
  pattern - An Awk regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression.

public  Patterncompile(String pattern, int options)
     Compiles an Awk regular expression into an AwkPattern instance that can be used by an AwkMatcher object to perform pattern matching.


Parameters:
  pattern - An Awk regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression.

public  Patterncompile(char[] pattern)
     Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile.

public  Patterncompile(String pattern)
     Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile.


Field Detail
CASE_INSENSITIVE_MASK
final public static int CASE_INSENSITIVE_MASK(Code)
A mask passed as an option to the AwkCompiler.compile compile methods to indicate a compiled regular expression should be case insensitive.



DEFAULT_MASK
final public static int DEFAULT_MASK(Code)
The default mask for the AwkCompiler.compile compile methods. It is equal to 0 and indicates no special options are active.



MULTILINE_MASK
final public static int MULTILINE_MASK(Code)
A mask passed as an option to the AwkCompiler.compile compile methods to indicate a compiled regular expression should treat input as having multiple lines. This option affects the interpretation of the . metacharacters. When this mask is used, the . metacharacter will not match newlines. The default behavior is for . to match newlines.



_END_OF_INPUT
final static char _END_OF_INPUT(Code)





Method Detail
_isLowerCase
static boolean _isLowerCase(char token)(Code)



_isUpperCase
static boolean _isUpperCase(char token)(Code)



_isWordCharacter
static boolean _isWordCharacter(char token)(Code)



_newTokenNode
SyntaxNode _newTokenNode(char token, int position)(Code)



_parse
SyntaxTree _parse(char[] expression) throws MalformedPatternException(Code)



_toggleCase
static char _toggleCase(char token)(Code)



compile
public Pattern compile(char[] pattern, int options) throws MalformedPatternException(Code)
Compiles an Awk regular expression into an AwkPattern instance that can be used by an AwkMatcher object to perform pattern matching.


Parameters:
  pattern - An Awk regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression. Currently theonly meaningful flag is AwkCompiler.CASE_INSENSITIVE_MASK. A Pattern instance constituting the compiled regular expression.This instance will always be an AwkPattern and can be reliablybe casted to an AwkPattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Awk regular expression.




compile
public Pattern compile(String pattern, int options) throws MalformedPatternException(Code)
Compiles an Awk regular expression into an AwkPattern instance that can be used by an AwkMatcher object to perform pattern matching.


Parameters:
  pattern - An Awk regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression. Currently theonly meaningful flag is AwkCompiler.CASE_INSENSITIVE_MASK. A Pattern instance constituting the compiled regular expression.This instance will always be an AwkPattern and can be reliablybe casted to an AwkPattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Awk regular expression.




compile
public Pattern compile(char[] pattern) throws MalformedPatternException(Code)
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile. A Pattern instance constituting the compiled regular expression.This instance will always be an AwkPattern and can be reliablybe casted to an AwkPattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Awk regular expression.




compile
public Pattern compile(String pattern) throws MalformedPatternException(Code)
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile. A Pattern instance constituting the compiled regular expression.This instance will always be an AwkPattern and can be reliablybe casted to an AwkPattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Awk regular expression.




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.