ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.oroinc.text.awk.AwkCompiler

java.lang.Object
   |
   +----com.oroinc.text.awk.AwkCompiler

public final class AwkCompiler
extends Object
implements PatternCompiler
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:

This is the extended syntax that is supported:

Copyright © 1997 Original Resuable Objects, Inc. All rights reserved.

See Also:
PatternCompiler, MalformedPatternException, AwkPattern, AwkMatcher

Variable Index

 o CASE_INSENSITIVE_MASK
 o DEFAULT_MASK

Constructor Index

 o AwkCompiler()

Method Index

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

 o compile(char[], int)
Compiles an Awk regular expression into an AwkPattern instance that can be used by an AwkMatcher object to perform pattern matching.
 o compile(String)
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);

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

Variables

 o DEFAULT_MASK
 public static final int DEFAULT_MASK
 o CASE_INSENSITIVE_MASK
 public static final int CASE_INSENSITIVE_MASK

Constructors

 o AwkCompiler
 public AwkCompiler()

Methods

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

Parameters:
pattern - An Awkregular expression to compile.
options - A set of flags giving the compiler instructions on how to treat the regular expression. Currently the only meaningful flag is AwkCompiler.CASE_INSENSITIVE_MASK.
Returns:
A Pattern instance constituting the compiled regular expression. This instance will always be an AwkPattern and can be reliably be casted to an AwkPattern.
Throws: MalformedPatternException
If the compiled expression is not a valid Awk regular expression.
 o compile
 public Pattern compile(String pattern,
                        int options) throws MalformedPatternException
Compiles an Awk regular expression into an AwkPattern instance that can be used by an AwkMatcher object to perform pattern matching.

Parameters:
pattern - An Awkregular expression to compile.
options - A set of flags giving the compiler instructions on how to treat the regular expression. Currently the only meaningful flag is AwkCompiler.CASE_INSENSITIVE_MASK.
Returns:
A Pattern instance constituting the compiled regular expression. This instance will always be an AwkPattern and can be reliably be casted to an AwkPattern.
Throws: MalformedPatternException
If the compiled expression is not a valid Awk regular expression.
 o compile
 public Pattern compile(char pattern[]) throws MalformedPatternException
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);

Parameters:
pattern - A regular expression to compile.
Returns:
A Pattern instance constituting the compiled regular expression. This instance will always be an AwkPattern and can be reliably be casted to an AwkPattern.
Throws: MalformedPatternException
If the compiled expression is not a valid Awk regular expression.
 o compile
 public Pattern compile(String pattern) throws MalformedPatternException
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);

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

ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index