aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java')
-rw-r--r--src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java b/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java
index c3356add..73752caa 100644
--- a/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java
+++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java
@@ -36,7 +36,7 @@ abstract class Compiler implements ErrorMessages {
protected final Analyser analyser;
protected final Regex regex;
- protected Compiler(Analyser analyser) {
+ protected Compiler(final Analyser analyser) {
this.analyser = analyser;
this.regex = analyser.regex;
}
@@ -52,21 +52,25 @@ abstract class Compiler implements ErrorMessages {
protected abstract void compileAltNode(ConsAltNode node);
- private void compileStringRawNode(StringNode sn) {
- if (sn.length() <= 0) return;
+ private void compileStringRawNode(final StringNode sn) {
+ if (sn.length() <= 0) {
+ return;
+ }
addCompileString(sn.chars, sn.p, sn.length(), false);
}
- private void compileStringNode(StringNode node) {
- StringNode sn = node;
- if (sn.length() <= 0) return;
+ private void compileStringNode(final StringNode node) {
+ final StringNode sn = node;
+ if (sn.length() <= 0) {
+ return;
+ }
- boolean ambig = sn.isAmbig();
+ final boolean ambig = sn.isAmbig();
int p, prev;
p = prev = sn.p;
- int end = sn.end;
- char[] chars = sn.chars;
+ final int end = sn.end;
+ final char[] chars = sn.chars;
p++;
int slen = 1;
@@ -87,7 +91,7 @@ abstract class Compiler implements ErrorMessages {
protected abstract void compileEncloseNode(EncloseNode node);
protected abstract void compileAnchorNode(AnchorNode node);
- protected final void compileTree(Node node) {
+ protected final void compileTree(final Node node) {
switch (node.getType()) {
case NodeType.LIST:
ConsAltNode lin = (ConsAltNode)node;
@@ -101,7 +105,7 @@ abstract class Compiler implements ErrorMessages {
break;
case NodeType.STR:
- StringNode sn = (StringNode)node;
+ final StringNode sn = (StringNode)node;
if (sn.isRaw()) {
compileStringRawNode(sn);
} else {
@@ -126,7 +130,7 @@ abstract class Compiler implements ErrorMessages {
break;
case NodeType.ENCLOSE:
- EncloseNode enode = (EncloseNode)node;
+ final EncloseNode enode = (EncloseNode)node;
if (enode.isOption()) {
compileOptionNode(enode);
} else {
@@ -144,15 +148,17 @@ abstract class Compiler implements ErrorMessages {
} // switch
}
- protected final void compileTreeNTimes(Node node, int n) {
- for (int i=0; i<n; i++) compileTree(node);
+ protected final void compileTreeNTimes(final Node node, final int n) {
+ for (int i=0; i<n; i++) {
+ compileTree(node);
+ }
}
- protected void newSyntaxException(String message) {
+ protected void newSyntaxException(final String message) {
throw new SyntaxException(message);
}
- protected void newInternalException(String message) {
+ protected void newInternalException(final String message) {
throw new InternalException(message);
}
}