mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71c224f83f | ||
|
|
71437eac81 | ||
|
|
5a5cb6425f | ||
|
|
a85171624b | ||
|
|
c2e22e55ad | ||
|
|
ea282d240e | ||
|
|
5bec62789e | ||
|
|
be2930f720 | ||
|
|
e665527182 | ||
|
|
3a30fbdd78 |
No files matched your search
@@ -2,8 +2,6 @@
|
||||
A simple, text based Java Bytecode Editor.
|
||||
It uses ObjectWeb ASM (http://asm.ow2.org/) and the RSyntaxTextArea from https://github.com/bobbylight/RSyntaxTextArea
|
||||
|
||||
Get the precompiled version from here: https://github.com/SuspiciousActivity/Random-Java-Stuff/blob/master/ByteEdit.jar
|
||||
|
||||
To open up a file, drag it onto the left side. To save a class, press CTRL + S on the right side, to save the jar file, press on the left side. With F5 you can reload either the file or only the class.
|
||||
|
||||
To search/replace in a file, press CTRL + F.
|
||||
@@ -12,12 +10,10 @@ To open a class, press CTRL + T.
|
||||
|
||||
To change settings like auto-computation of stack frames and max locals/stack press CTRL + O.
|
||||
|
||||
To go to the field/method definition in the selected line press CTRL + G.
|
||||
|
||||
To (un-)escape unicode characters, press CTRL + U.
|
||||
|
||||
To rename a field/method with attention to references in the selected line, press CTRL + R.
|
||||
|
||||
To quickly compile some java code, press CTRL + E.
|
||||
|
||||
To switch between light and dark theme, press CTRL + B.
|
||||
To switch between themes, press CTRL + B.
|
||||
@@ -160,7 +160,7 @@ public class CompilationBox extends JFrame {
|
||||
}, ctrlS, JComponent.WHEN_FOCUSED);
|
||||
}
|
||||
|
||||
class JavaSourceFromString extends SimpleJavaFileObject {
|
||||
private static class JavaSourceFromString extends SimpleJavaFileObject {
|
||||
final String code;
|
||||
|
||||
public JavaSourceFromString(String name, String code) {
|
||||
|
||||
@@ -123,13 +123,16 @@ public class SearchBox extends JFrame {
|
||||
}
|
||||
|
||||
public void replace() {
|
||||
String txt = Main.txtByteEditView.getText();
|
||||
if (!Main.decompiler.isEditable())
|
||||
return;
|
||||
int startPos = Main.txtByteEditView.getSelectionStart();
|
||||
Main.txtByteEditView.replaceSelection(txtReplace.getText());
|
||||
Main.txtByteEditView.select(startPos, startPos + txtReplace.getText().length());
|
||||
}
|
||||
|
||||
public void replaceAll() {
|
||||
if (!Main.decompiler.isEditable())
|
||||
return;
|
||||
String toFind = txtFind.getText();
|
||||
String toReplace = txtReplace.getText();
|
||||
String txt = Main.txtByteEditView.getText();
|
||||
|
||||
@@ -40,11 +40,10 @@ public class TypeOpenBox extends JFrame {
|
||||
DefaultListModel<String> model = new DefaultListModel<>();
|
||||
JList<String> list = new JList(model);
|
||||
list.addListSelectionListener(new ListSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
String val = list.getSelectedValue();
|
||||
if (val != null && !val.equals(Main.currentNodeName)) {
|
||||
|
||||
SingleThreadedExecutor.execute(() -> Main.selectFile(val));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,24 +3,13 @@ package me.ByteEdit.decompiler;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.benf.cfr.reader.PluginRunner;
|
||||
import org.benf.cfr.reader.api.ClassFileSource;
|
||||
import org.benf.cfr.reader.bytecode.analysis.parse.utils.Pair;
|
||||
import org.benf.cfr.reader.entities.ClassFile;
|
||||
import org.benf.cfr.reader.entities.Method;
|
||||
import org.benf.cfr.reader.entities.constantpool.ConstantPool;
|
||||
import org.benf.cfr.reader.state.ClassFileSourceImpl;
|
||||
import org.benf.cfr.reader.state.DCCommonState;
|
||||
import org.benf.cfr.reader.util.bytestream.BaseByteData;
|
||||
import org.benf.cfr.reader.util.getopt.OptionsImpl;
|
||||
import org.benf.cfr.reader.util.output.ToStringDumper;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
public class CFRDecompiler implements IDecompiler {
|
||||
|
||||
@@ -83,10 +72,10 @@ public class CFRDecompiler implements IDecompiler {
|
||||
|
||||
@Override
|
||||
public String decompile(ClassNode cn) {
|
||||
return doDecompilation(cn, getBytes(cn), null);
|
||||
return doDecompilation(cn, getBytes(cn));
|
||||
}
|
||||
|
||||
private static String doDecompilation(ClassNode cn, byte[] b, MethodNode mn) {
|
||||
private static String doDecompilation(ClassNode cn, byte[] b) {
|
||||
try {
|
||||
HashMap<String, String> ops = options;
|
||||
ClassFileSource cfs = new ClassFileSource() {
|
||||
@@ -114,24 +103,7 @@ public class CFRDecompiler implements IDecompiler {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
};
|
||||
PluginRunner runner = new PluginRunner(ops, cfs);
|
||||
if (mn != null) {
|
||||
BaseByteData data = new BaseByteData(b);
|
||||
ClassFile cf = new ClassFile(data, "", initDCState(ops, cfs));
|
||||
Field cpf = Method.class.getDeclaredField("cp");
|
||||
Field descI = Method.class.getDeclaredField("descriptorIndex");
|
||||
descI.setAccessible(true);
|
||||
cpf.setAccessible(true);
|
||||
for (Method m : cf.getMethodByName(mn.name)) {
|
||||
ConstantPool cp = (ConstantPool) cpf.get(m);
|
||||
if (cp.getUTF8Entry(descI.getInt(m)).getValue().equals(mn.desc)) {
|
||||
ToStringDumper tsd = new ToStringDumper();
|
||||
m.dump(tsd, true);
|
||||
return tsd.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
String decompilation = runner.getDecompilationFor(cn.name);
|
||||
String decompilation = new PluginRunner(ops, cfs).getDecompilationFor(cn.name);
|
||||
System.gc(); // cfr has a performance bug
|
||||
return decompilation;
|
||||
} catch (Exception e) {
|
||||
@@ -142,12 +114,4 @@ public class CFRDecompiler implements IDecompiler {
|
||||
return sw.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static DCCommonState initDCState(Map<String, String> optionsMap, ClassFileSource classFileSource) {
|
||||
OptionsImpl options = new OptionsImpl(optionsMap);
|
||||
if (classFileSource == null)
|
||||
classFileSource = new ClassFileSourceImpl(options);
|
||||
DCCommonState dcCommonState = new DCCommonState(options, classFileSource);
|
||||
return dcCommonState;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import org.jetbrains.java.decompiler.main.Fernflower;
|
||||
@@ -16,7 +17,6 @@ import org.jetbrains.java.decompiler.struct.StructClass;
|
||||
import org.jetbrains.java.decompiler.struct.StructContext;
|
||||
import org.jetbrains.java.decompiler.struct.lazy.LazyLoader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
public class FernflowerDecompiler implements IBytecodeProvider, IResultSaver, IDecompiler {
|
||||
|
||||
@@ -52,17 +52,18 @@ public class FernflowerDecompiler implements IBytecodeProvider, IResultSaver, ID
|
||||
|
||||
@Override
|
||||
public String decompile(ClassNode cn) {
|
||||
return doDecompilation(cn, getBytes(cn), null);
|
||||
return doDecompilation(cn, getBytes(cn));
|
||||
}
|
||||
|
||||
public String doDecompilation(ClassNode cn, byte[] b, MethodNode mn) {
|
||||
public String doDecompilation(ClassNode cn, byte[] b) {
|
||||
try {
|
||||
// TODO decompile method only
|
||||
this.bytes = b;
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
for (String key : options.keySet()) {
|
||||
map.put(key, options.get(key) ? "1" : "0");
|
||||
for (Entry<String, Boolean> entry : options.entrySet()) {
|
||||
map.put(entry.getKey(), entry.getValue() ? "1" : "0");
|
||||
}
|
||||
map.put("ind", " ");
|
||||
Fernflower f = new Fernflower(this, this, map, new IFernflowerLogger() {
|
||||
@Override
|
||||
public void writeMessage(String message, Throwable t) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class JDDecompiler implements Loader, Printer, IDecompiler {
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
protected static final String TAB = " ";
|
||||
protected static final String TAB = " ";
|
||||
protected static final String NEWLINE = "\n";
|
||||
|
||||
protected int indentationCount = 0;
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.StringWriter;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import com.strobel.assembler.InputTypeLoader;
|
||||
import com.strobel.assembler.metadata.Buffer;
|
||||
@@ -21,10 +20,10 @@ public class ProcyonDecompiler implements IDecompiler {
|
||||
|
||||
@Override
|
||||
public String decompile(ClassNode cn) {
|
||||
return doDecompilation(cn, getBytes(cn), null);
|
||||
return doDecompilation(cn, getBytes(cn));
|
||||
}
|
||||
|
||||
private static String doDecompilation(ClassNode cn, byte[] b, MethodNode mn) {
|
||||
private static String doDecompilation(ClassNode cn, byte[] b) {
|
||||
try {
|
||||
// TODO decompile method only
|
||||
DecompilerSettings settings = new DecompilerSettings();
|
||||
@@ -48,9 +47,8 @@ public class ProcyonDecompiler implements IDecompiler {
|
||||
buffer.putByteArray(b, 0, b.length);
|
||||
buffer.position(0);
|
||||
return true;
|
||||
} else {
|
||||
return backLoader.tryLoadType(s, buffer);
|
||||
}
|
||||
return backLoader.tryLoadType(s, buffer);
|
||||
}
|
||||
});
|
||||
TypeReference type = metadataSystem.lookupType(cn.name);
|
||||
|
||||
@@ -17,6 +17,7 @@ public class SingleThreadedExecutor {
|
||||
}, "SingleThreadedExecutor");
|
||||
|
||||
static {
|
||||
thread.setPriority(Thread.MAX_PRIORITY);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ import me.ByteEdit.utils.UnicodeUtils;
|
||||
public class Assembler {
|
||||
|
||||
public static final Pattern SPACE = Pattern.compile(" ");
|
||||
private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
|
||||
|
||||
public static ClassNode assemble(String input) {
|
||||
Main.txtByteEditView.removeAllLineHighlights();
|
||||
@@ -338,6 +339,8 @@ public class Assembler {
|
||||
tryCatchBlocksToParse.clear();
|
||||
stage = 0;
|
||||
} else if (s.startsWith("// #Signature: ")) {
|
||||
if (node == null)
|
||||
throw new IllegalStateException("node is null");
|
||||
node.signature = UnicodeUtils.unescape(hsr, s.substring(15));
|
||||
} else if (s.equals("// #TryCatch:")) {
|
||||
stage = 1;
|
||||
@@ -351,6 +354,8 @@ public class Assembler {
|
||||
localVarsToParse.add(s);
|
||||
}
|
||||
} else if (s.equals("}")) {
|
||||
if (node == null)
|
||||
throw new IllegalStateException("node is null");
|
||||
if (!annotationsForNext.isEmpty()) {
|
||||
if (node.visibleAnnotations == null) {
|
||||
node.visibleAnnotations = new ArrayList<>();
|
||||
@@ -403,6 +408,8 @@ public class Assembler {
|
||||
}
|
||||
clazz.methods.add(node);
|
||||
} else if (!s.startsWith("\t")) {
|
||||
if (node == null)
|
||||
throw new IllegalStateException("node is null");
|
||||
s = s.substring(0, s.length() - 2);
|
||||
if (s.contains(" throws ")) {
|
||||
String exceptions = s.substring(s.lastIndexOf(" throws ") + 8);
|
||||
@@ -476,6 +483,8 @@ public class Assembler {
|
||||
s = s.substring(1);
|
||||
if (!temp.isEmpty()) {
|
||||
if (s.equals("]")) {
|
||||
if (node == null)
|
||||
throw new IllegalStateException("node is null");
|
||||
temp += s;
|
||||
node.instructions.add(getNode(hsr, temp, methodLabelMap));
|
||||
temp = "";
|
||||
@@ -486,6 +495,8 @@ public class Assembler {
|
||||
if (s.endsWith("[")) {
|
||||
temp += s + "\n";
|
||||
} else {
|
||||
if (node == null)
|
||||
throw new IllegalStateException("node is null");
|
||||
node.instructions.add(getNode(hsr, s, methodLabelMap));
|
||||
}
|
||||
}
|
||||
@@ -494,18 +505,21 @@ public class Assembler {
|
||||
}
|
||||
return clazz;
|
||||
} catch (Throwable e) {
|
||||
System.err.println("Error at line: " + read.currentLine);
|
||||
try {
|
||||
Main.txtByteEditView.setCaretPosition(Main.txtByteEditView.getLineStartOffset(read.currentLine));
|
||||
} catch (BadLocationException e1) {
|
||||
System.err.println("Can't show line!");
|
||||
if (read != null) {
|
||||
System.err.println("Error at line: " + read.currentLine);
|
||||
try {
|
||||
Main.txtByteEditView.setCaretPosition(Main.txtByteEditView.getLineStartOffset(read.currentLine));
|
||||
} catch (BadLocationException e1) {
|
||||
System.err.println("Can't show line!");
|
||||
}
|
||||
}
|
||||
Main.showError(e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} finally {
|
||||
try {
|
||||
read.close();
|
||||
if (read != null)
|
||||
read.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
@@ -599,26 +613,28 @@ public class Assembler {
|
||||
if (args.length == 0) {
|
||||
return null;
|
||||
}
|
||||
String ret = args[start];
|
||||
StringBuilder sb = new StringBuilder(args[start]);
|
||||
if (args.length > start + 1) {
|
||||
for (int i = start + 1; i < args.length; i++) {
|
||||
ret = ret + " " + args[i];
|
||||
sb.append(' ');
|
||||
sb.append(args[i]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String consolidateStrings(String[] args, int start, int end) {
|
||||
if (end == 0) {
|
||||
return null;
|
||||
}
|
||||
String ret = args[start];
|
||||
StringBuilder sb = new StringBuilder(args[start]);
|
||||
if (end > start + 1) {
|
||||
for (int i = start + 1; i < end; i++) {
|
||||
ret = ret + " " + args[i];
|
||||
sb.append(' ');
|
||||
sb.append(args[i]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static Object getValue(HugeStringsRev hsr, String s, String to) {
|
||||
@@ -1484,12 +1500,6 @@ public class Assembler {
|
||||
}
|
||||
}
|
||||
}
|
||||
Object[] _args = new Object[args.size()];
|
||||
stage = 0;
|
||||
for (Object o : args) {
|
||||
_args[stage] = o;
|
||||
stage++;
|
||||
}
|
||||
return new InvokeDynamicInsnNode(UnicodeUtils.unescape(hsr, sp[0].substring(7)),
|
||||
UnicodeUtils.unescape(hsr, sp[1].substring(6)),
|
||||
new Handle(OpcodesReverse.getHandleOpcode(sp[7].substring(6)),
|
||||
@@ -1497,7 +1507,7 @@ public class Assembler {
|
||||
UnicodeUtils.unescape(hsr, sp[3].substring(7)),
|
||||
UnicodeUtils.unescape(hsr, sp[5].substring(7)),
|
||||
Boolean.parseBoolean(sp[6].substring(14))),
|
||||
_args);
|
||||
args.toArray(new Object[args.size()]));
|
||||
}
|
||||
case "new": {
|
||||
return new TypeInsnNode(187, UnicodeUtils.unescape(hsr, split[1]));
|
||||
@@ -1560,44 +1570,37 @@ public class Assembler {
|
||||
private static Object[] parseFrameList(HugeStringsRev hsr, String str, HashMap<LabelNode, Integer> labels) {
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
String l = str.substring(1, str.length() - 1);
|
||||
if (l.isEmpty()) {
|
||||
return new Object[0];
|
||||
} else {
|
||||
for (String asd : l.split(", ")) {
|
||||
if (!asd.startsWith("(")) {
|
||||
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||
if (frameType != -1)
|
||||
list.add(new Integer(frameType));
|
||||
else
|
||||
list.add(UnicodeUtils.unescape(hsr, asd.substring(1, asd.length() - 1)));
|
||||
} else {
|
||||
if (asd.startsWith("(label) ")) {
|
||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||
boolean found = false;
|
||||
for (Map.Entry<LabelNode, Integer> entry : labels.entrySet()) {
|
||||
if (entry.getValue() == labelNr) {
|
||||
list.add(entry.getKey());
|
||||
found = true;
|
||||
}
|
||||
if (l.isEmpty())
|
||||
return EMPTY_OBJECT_ARRAY;
|
||||
|
||||
for (String asd : l.split(", ")) {
|
||||
if (!asd.startsWith("(")) {
|
||||
int frameType = ClassUtil.getFrameTypeByName(asd);
|
||||
if (frameType != -1)
|
||||
list.add(Integer.valueOf(frameType));
|
||||
else
|
||||
list.add(UnicodeUtils.unescape(hsr, asd.substring(1, asd.length() - 1)));
|
||||
} else {
|
||||
if (asd.startsWith("(label) ")) {
|
||||
int labelNr = Integer.parseInt(asd.split(" ")[1]);
|
||||
boolean found = false;
|
||||
for (Map.Entry<LabelNode, Integer> entry : labels.entrySet()) {
|
||||
if (entry.getValue() == labelNr) {
|
||||
list.add(entry.getKey());
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
LabelNode ln = new LabelNode(new Label());
|
||||
labels.put(ln, labelNr);
|
||||
list.add(ln);
|
||||
}
|
||||
} else {
|
||||
list.add(ClassUtil.getCastedValue(asd.split(" ")[1], asd.split("\\) ")[0].substring(1)));
|
||||
}
|
||||
if (!found) {
|
||||
LabelNode ln = new LabelNode(new Label());
|
||||
labels.put(ln, labelNr);
|
||||
list.add(ln);
|
||||
}
|
||||
} else {
|
||||
list.add(ClassUtil.getCastedValue(asd.split(" ")[1], asd.split("\\) ")[0].substring(1)));
|
||||
}
|
||||
}
|
||||
Object[] arr = new Object[list.size()];
|
||||
int c = 0;
|
||||
for (Object o : list) {
|
||||
arr[c] = o;
|
||||
c++;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
return list.toArray(new Object[list.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class Disassembler implements IDecompiler {
|
||||
ctx.next("\n// #Fields\n");
|
||||
ctx.next(doFields(classNode.fields, hs));
|
||||
ctx.next("\n// #Methods\n");
|
||||
ctx.next(doMethods(classNode.methods, classNode.name, hs));
|
||||
ctx.next(doMethods(classNode.methods, hs));
|
||||
ctx.next("}\n");
|
||||
|
||||
if (!hs.isEmpty())
|
||||
@@ -154,48 +154,47 @@ public class Disassembler implements IDecompiler {
|
||||
s += o + " = [";
|
||||
valBefore = false;
|
||||
continue;
|
||||
} else {
|
||||
if (o instanceof String[]) {
|
||||
String[] arr = (String[]) o;
|
||||
boolean w8ing = false;
|
||||
for (String rofl : arr) {
|
||||
if (!w8ing) {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl) + "/";
|
||||
w8ing = true;
|
||||
} else {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl) + "]";
|
||||
}
|
||||
if (o instanceof String[]) {
|
||||
String[] arr = (String[]) o;
|
||||
boolean w8ing = false;
|
||||
for (String rofl : arr) {
|
||||
if (!w8ing) {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl) + "/";
|
||||
w8ing = true;
|
||||
} else {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl) + "]";
|
||||
}
|
||||
}
|
||||
s += ", ";
|
||||
} else if (o instanceof List) {
|
||||
List list = (List) o;
|
||||
s += "{ ";
|
||||
for (Object obj : list) {
|
||||
if (obj instanceof String[]) {
|
||||
String[] arr = (String[]) obj;
|
||||
boolean w8ing = false;
|
||||
for (String rofl : arr) {
|
||||
if (!w8ing) {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl) + "/";
|
||||
w8ing = true;
|
||||
} else {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s += "\"" + UnicodeUtils.escape(hs, String.valueOf(obj)) + "\"";
|
||||
}
|
||||
s += ", ";
|
||||
} else if (o instanceof List) {
|
||||
List list = (List) o;
|
||||
s += "{ ";
|
||||
for (Object obj : list) {
|
||||
if (obj instanceof String[]) {
|
||||
String[] arr = (String[]) obj;
|
||||
boolean w8ing = false;
|
||||
for (String rofl : arr) {
|
||||
if (!w8ing) {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl) + "/";
|
||||
w8ing = true;
|
||||
} else {
|
||||
s += UnicodeUtils.escapeWithSpaces(hs, rofl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s += "\"" + UnicodeUtils.escape(hs, String.valueOf(obj)) + "\"";
|
||||
}
|
||||
s += ", ";
|
||||
}
|
||||
s = s.substring(0, s.length() - 2);
|
||||
s += " }], ";
|
||||
} else if (o instanceof String) {
|
||||
s += "\"" + UnicodeUtils.escapeWithSpaces(hs, (String) o) + "\"], ";
|
||||
} else {
|
||||
s += "(" + o.getClass().getName().replace(".", "/") + ") " + o + "], ";
|
||||
}
|
||||
valBefore = true;
|
||||
s = s.substring(0, s.length() - 2);
|
||||
s += " }], ";
|
||||
} else if (o instanceof String) {
|
||||
s += "\"" + UnicodeUtils.escapeWithSpaces(hs, (String) o) + "\"], ";
|
||||
} else {
|
||||
s += "(" + o.getClass().getName().replace(".", "/") + ") " + o + "], ";
|
||||
}
|
||||
valBefore = true;
|
||||
}
|
||||
if (s.endsWith(", "))
|
||||
s = s.substring(0, s.length() - 2);
|
||||
@@ -207,7 +206,7 @@ public class Disassembler implements IDecompiler {
|
||||
return ctx.finish();
|
||||
}
|
||||
|
||||
private static String doMethods(List<MethodNode> methods, String className, HugeStrings hs)
|
||||
private static String doMethods(List<MethodNode> methods, HugeStrings hs)
|
||||
throws InterruptedException, ExecutionException {
|
||||
boolean multithreaded = Main.INSTANCE.mntmMultithreaded.isSelected();
|
||||
Future<String>[] futures = new Future[methods.size()];
|
||||
@@ -221,7 +220,7 @@ public class Disassembler implements IDecompiler {
|
||||
ms += "\t// #Max: l:" + mn.maxLocals + " s:" + mn.maxStack + "\n";
|
||||
if (mn.signature != null)
|
||||
ms += "\t// #Signature: " + UnicodeUtils.escapeWithSpaces(hs, mn.signature) + "\n";
|
||||
String[] dis = disassembleMethod(className, mn, hs);
|
||||
String[] dis = disassembleMethod(mn, hs);
|
||||
ms += dis[2];
|
||||
ms += dis[1];
|
||||
if (mn.visibleAnnotations != null && !mn.visibleAnnotations.isEmpty())
|
||||
@@ -286,7 +285,7 @@ public class Disassembler implements IDecompiler {
|
||||
return ctx.finish();
|
||||
}
|
||||
|
||||
private static String[] disassembleMethod(String className, MethodNode mn, HugeStrings hs) {
|
||||
private static String[] disassembleMethod(MethodNode mn, HugeStrings hs) {
|
||||
HashMap<Label, Integer> labels = new HashMap<Label, Integer>();
|
||||
String localVarTable;
|
||||
String tryCatchTable;
|
||||
@@ -299,7 +298,7 @@ public class Disassembler implements IDecompiler {
|
||||
for (AbstractInsnNode n = insnList.getFirst(); n != null; n = n.getNext()) {
|
||||
if (n instanceof LabelNode) {
|
||||
int id = labels.size() + 1;
|
||||
if (deobfNumbers)
|
||||
if (deobfNumbers && labelsReversed != null)
|
||||
labelsReversed.add(((LabelNode) n).getLabel());
|
||||
labels.put(((LabelNode) n).getLabel(), id);
|
||||
}
|
||||
@@ -336,7 +335,7 @@ public class Disassembler implements IDecompiler {
|
||||
insnList = calc.get();
|
||||
int i = 0;
|
||||
for (AbstractInsnNode n = insnList.getFirst(); n != null; n = n.getNext()) {
|
||||
if (n instanceof LabelNode) {
|
||||
if (n instanceof LabelNode && labelsReversed != null) {
|
||||
((LabelNode) n).setLabel(labelsReversed.get(i++));
|
||||
}
|
||||
}
|
||||
@@ -359,9 +358,8 @@ public class Disassembler implements IDecompiler {
|
||||
if (n.getOpcode() == Opcodes.NEWARRAY) {
|
||||
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " "
|
||||
+ ClassUtil.getArrayTypeByID(node.operand) + "\n";
|
||||
} else {
|
||||
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + node.operand + "\n";
|
||||
}
|
||||
return "\t\t" + OpcodesReverse.reverseOpcode(n.getOpcode()) + " " + node.operand + "\n";
|
||||
}
|
||||
case VAR_INSN: {
|
||||
VarInsnNode node = (VarInsnNode) n;
|
||||
@@ -443,16 +441,15 @@ public class Disassembler implements IDecompiler {
|
||||
+ valueEnd + "\n\t\t\tbuf: " + ClassUtil.getDecompiledValue(buf, "", hs);
|
||||
s += "\n\t\t]\n";
|
||||
return s;
|
||||
} else {
|
||||
String decomp = ClassUtil.getDecompiledValue(node.cst, "", hs);
|
||||
if (node.cst instanceof String) {
|
||||
if (decomp.startsWith("\"#") && decomp.endsWith("\""))
|
||||
decomp = decomp.substring(1, decomp.length() - 1);
|
||||
else if (decomp.startsWith("\"\\u0023"))
|
||||
decomp = "\"#" + decomp.substring(7);
|
||||
}
|
||||
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + decomp + "\n";
|
||||
}
|
||||
String decomp = ClassUtil.getDecompiledValue(node.cst, "", hs);
|
||||
if (node.cst instanceof String) {
|
||||
if (decomp.startsWith("\"#") && decomp.endsWith("\""))
|
||||
decomp = decomp.substring(1, decomp.length() - 1);
|
||||
else if (decomp.startsWith("\"\\u0023"))
|
||||
decomp = "\"#" + decomp.substring(7);
|
||||
}
|
||||
return "\t\t" + OpcodesReverse.reverseOpcode(node.getOpcode()) + " " + decomp + "\n";
|
||||
}
|
||||
case IINC_INSN: {
|
||||
IincInsnNode node = (IincInsnNode) n;
|
||||
|
||||
@@ -131,7 +131,6 @@ public class SearchBox extends JFrame {
|
||||
}
|
||||
|
||||
public void replace() {
|
||||
String txt = Main.txtByteEditView.getText();
|
||||
int startPos = Main.txtByteEditView.getSelectionStart();
|
||||
Main.txtByteEditView.replaceSelection(txtReplace.getText());
|
||||
Main.txtByteEditView.select(startPos, startPos + txtReplace.getText().length());
|
||||
|
||||
@@ -48,11 +48,10 @@ public class TypeOpenBox extends JFrame {
|
||||
DefaultListModel<String> model = new DefaultListModel<>();
|
||||
JList<String> list = new JList(model);
|
||||
list.addListSelectionListener(new ListSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
String val = list.getSelectedValue();
|
||||
if (val != null && !val.equals(Main.currentNodeName)) {
|
||||
|
||||
SingleThreadedExecutor.execute(() -> Main.selectFile(val));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
package me.ByteEdit.main;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
public class ArchiveTreeModel extends DefaultTreeModel {
|
||||
|
||||
public final ArrayList<String> paths = new ArrayList<>();
|
||||
private final HashMap<String, ClassNode> classNodes;
|
||||
private final HashMap<String, byte[]> otherFiles;
|
||||
private final ZipFile jar;
|
||||
|
||||
public boolean newCreated = false;
|
||||
|
||||
public ArchiveTreeModel(HashMap<String, ClassNode> classNodes, HashMap<String, byte[]> otherFiles) {
|
||||
super(new ByteEditTreeNode("New"));
|
||||
this.newCreated = true;
|
||||
this.jar = null;
|
||||
this.classNodes = classNodes;
|
||||
this.otherFiles = otherFiles;
|
||||
}
|
||||
|
||||
public ArchiveTreeModel(ZipFile jar, HashMap<String, ClassNode> classNodes, HashMap<String, byte[]> otherFiles) {
|
||||
super(new ByteEditTreeNode(jar.getName().split(File.separator.equals("\\") ? "\\\\"
|
||||
: File.separator)[jar.getName().split(File.separator.equals("\\") ? "\\\\" : File.separator).length
|
||||
- 1]));
|
||||
this.newCreated = true;
|
||||
this.jar = jar;
|
||||
this.classNodes = classNodes;
|
||||
this.otherFiles = otherFiles;
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
try {
|
||||
classNodes.clear();
|
||||
otherFiles.clear();
|
||||
Enumeration<? extends ZipEntry> enumeration = jar.entries();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
ZipEntry next = enumeration.nextElement();
|
||||
byte[] data = toByteArray(jar.getInputStream(next));
|
||||
if (next.getSize() != 0 && !next.getName().startsWith("META-INF")
|
||||
&& (next.getName().endsWith(".class") || next.getName().endsWith(".class/"))) {
|
||||
try {
|
||||
ClassReader reader = new ClassReader(data);
|
||||
ClassNode node = new ClassNode();
|
||||
reader.accept(node, 0);
|
||||
classNodes.put(Main.getFullName(node.name), node);
|
||||
|
||||
if ((next.getName().contains("/")
|
||||
? (!Main.patternSlash
|
||||
.split(next.getName())[Main.patternSlash.split(next.getName()).length - 1]
|
||||
.contains("$"))
|
||||
: (!next.getName().contains("$")))
|
||||
|| (next.getName().startsWith("$") || next.getName().contains("$$")
|
||||
|| next.getName().endsWith("$"))) {
|
||||
paths.add(Main.getFullName(node.name));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
otherFiles.put(next.getName(), data);
|
||||
}
|
||||
} else {
|
||||
otherFiles.put(next.getName(), data);
|
||||
}
|
||||
}
|
||||
jar.close();
|
||||
refresh();
|
||||
} catch (Throwable e) {
|
||||
classNodes.clear();
|
||||
otherFiles.clear();
|
||||
e.printStackTrace();
|
||||
Main.showError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getSlashCount(String s) {
|
||||
int count = 0;
|
||||
for (char c : s.toCharArray()) {
|
||||
if (c == '/')
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
setRoot(new ByteEditTreeNode(((ByteEditTreeNode) getRoot()).toString()));
|
||||
Collections.sort(paths, String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(paths, new Comparator<String>() {
|
||||
public int compare(String s1, String s2) {
|
||||
return getSlashCount(s2) - getSlashCount(s1);
|
||||
}
|
||||
});
|
||||
|
||||
// Windows-like sorting (like file explorer)
|
||||
List<String> tmp = new ArrayList<>(paths);
|
||||
|
||||
List<String> folders = tmp.stream().filter(s -> {
|
||||
int c = countSlashes(s, 50);
|
||||
return c > 0 && c < 50;
|
||||
}).map(s -> {
|
||||
int idx = s.lastIndexOf('/');
|
||||
if (idx == s.length() - 1)
|
||||
idx = s.lastIndexOf('/', idx - 1);
|
||||
if (idx == -1)
|
||||
return s;
|
||||
return s.substring(0, idx);
|
||||
}).distinct().sorted(new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String s, String s2) {
|
||||
// From String#compareToIgnoreCase(String)
|
||||
int n = s.length();
|
||||
int n2 = s2.length();
|
||||
int n3 = Math.min(n, n2);
|
||||
for (int i = 0; i < n3; ++i) {
|
||||
char c;
|
||||
char c2 = s.charAt(i);
|
||||
if (c2 == (c = s2.charAt(i)) || (c2 = Character.toUpperCase(c2)) == (c = Character.toUpperCase(c))
|
||||
|| (c2 = Character.toLowerCase(c2)) == (c = Character.toLowerCase(c)))
|
||||
continue;
|
||||
return c2 - c;
|
||||
}
|
||||
// Other way around
|
||||
return n2 - n;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
tmp.removeAll(folders);
|
||||
tmp.addAll(0, folders);
|
||||
|
||||
for (String s : tmp) {
|
||||
String[] elements = Main.patternSlash.split(s, 50);
|
||||
if (elements.length >= 50) {
|
||||
((ByteEditTreeNode) getRoot()).add(new ByteEditTreeNode(s, s));
|
||||
} else {
|
||||
ByteEditTreeNode currentNode = (ByteEditTreeNode) getRoot();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
String token = elements[i];
|
||||
ByteEditTreeNode nextNode = findNode(currentNode, token);
|
||||
if (nextNode == null) {
|
||||
nextNode = new ByteEditTreeNode(token, s);
|
||||
currentNode.add(nextNode);
|
||||
}
|
||||
currentNode = nextNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ByteEditTreeNode findNode(ByteEditTreeNode parent, String name) {
|
||||
Enumeration<?> e = parent.children();
|
||||
while (e.hasMoreElements()) {
|
||||
ByteEditTreeNode element = (ByteEditTreeNode) e.nextElement();
|
||||
if (element.getUserObject().equals(name)) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int countSlashes(String s, int max) {
|
||||
int count = 0;
|
||||
for (char c : s.toCharArray()) {
|
||||
if (c == '/') {
|
||||
count++;
|
||||
if (count == max)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static byte[] toByteArray(final InputStream input) throws IOException {
|
||||
try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int read;
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
return output.toByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package me.ByteEdit.main;
|
||||
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.event.TreeExpansionEvent;
|
||||
import javax.swing.event.TreeExpansionListener;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
public class FurtherExpandingTreeExpansionListener implements TreeExpansionListener {
|
||||
|
||||
private final JTree tree;
|
||||
|
||||
public FurtherExpandingTreeExpansionListener(JTree tree) {
|
||||
this.tree = tree;
|
||||
}
|
||||
|
||||
public void treeExpanded(TreeExpansionEvent event) {
|
||||
TreePath treePath = event.getPath();
|
||||
Object expandedTreePathObject = treePath.getLastPathComponent();
|
||||
if (!(expandedTreePathObject instanceof TreeNode))
|
||||
return;
|
||||
TreeNode expandedTreeNode = (TreeNode) expandedTreePathObject;
|
||||
if (expandedTreeNode.getChildCount() == 1) {
|
||||
TreeNode descendantTreeNode = expandedTreeNode.getChildAt(0);
|
||||
if (descendantTreeNode.isLeaf())
|
||||
return;
|
||||
TreePath nextTreePath = treePath.pathByAddingChild(descendantTreeNode);
|
||||
tree.expandPath(nextTreePath);
|
||||
}
|
||||
}
|
||||
|
||||
public void treeCollapsed(TreeExpansionEvent event) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package me.ByteEdit.main;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
import org.fife.ui.rtextarea.RTextArea;
|
||||
import org.fife.ui.rtextarea.ToolTipSupplier;
|
||||
|
||||
import me.ByteEdit.edit.Assembler;
|
||||
|
||||
public class HugeStringsToolTips implements ToolTipSupplier {
|
||||
|
||||
private final RSyntaxTextArea txtByteEditView;
|
||||
|
||||
public HugeStringsToolTips(RSyntaxTextArea txtByteEditView) {
|
||||
this.txtByteEditView = txtByteEditView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTipText(RTextArea textArea, MouseEvent e) {
|
||||
int idx = textArea.viewToModel(e.getPoint());
|
||||
if (idx < 0)
|
||||
return null;
|
||||
int subIdx = Math.max(idx - 15, 0);
|
||||
int subLen = Math.min(30, textArea.getDocument().getLength() - subIdx);
|
||||
if (subLen <= 0)
|
||||
return null;
|
||||
try {
|
||||
String cut = textArea.getText(subIdx, subLen);
|
||||
int hashIdx = -1;
|
||||
for (int off = idx - subIdx; off >= 0; off--) {
|
||||
if (cut.charAt(off) == '#') {
|
||||
hashIdx = off;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hashIdx < 0) {
|
||||
for (int off = idx - subIdx; off < cut.length(); off++) {
|
||||
if (cut.charAt(off) == '#') {
|
||||
hashIdx = off;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hashIdx < 0)
|
||||
return null;
|
||||
if (hashIdx >= 5 && cut.substring(hashIdx - 5, hashIdx).equals("ldc \"")) // ldc "#..."
|
||||
return null;
|
||||
int numLen = 1;
|
||||
for (int i = hashIdx + 1; i < cut.length(); i++) {
|
||||
if (!(cut.charAt(i) - '0' >= 0 && cut.charAt(i) - '0' <= 9)) {
|
||||
break;
|
||||
}
|
||||
numLen++;
|
||||
}
|
||||
if (numLen < 2 || hashIdx > idx - subIdx || idx - subIdx - numLen >= hashIdx)
|
||||
return null;
|
||||
String hashNum = cut.substring(hashIdx, hashIdx + numLen);
|
||||
|
||||
String txt = txtByteEditView.getText();
|
||||
int len = 0;
|
||||
for (String asm : txt.split("\\/\\/ #Annotations:\n")) {
|
||||
len += 19; // "\\/\\/ #Annotations:\n".length()
|
||||
if (asm.isEmpty())
|
||||
continue;
|
||||
if (idx >= len && idx < len + asm.length()) {
|
||||
try (BufferedReader reader = new BufferedReader(new StringReader(asm))) {
|
||||
String s;
|
||||
while (!(s = reader.readLine()).startsWith("// #SourceFile: ")) {
|
||||
}
|
||||
while (!(s = reader.readLine()).equals("// #Fields")) {
|
||||
if (s.startsWith("#")) {
|
||||
String[] split = Assembler.SPACE.split(s, 2);
|
||||
if (hashNum.equals(split[0].substring(0, split[0].length() - 1))) {
|
||||
String toolTip = split[1];
|
||||
if (toolTip.length() > 500)
|
||||
toolTip = toolTip.substring(0, 500) + "...";
|
||||
return toolTip;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
len += asm.length();
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+86
-361
@@ -20,26 +20,17 @@ import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
@@ -63,16 +54,10 @@ import javax.swing.JSplitPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.TreeExpansionEvent;
|
||||
import javax.swing.event.TreeExpansionListener;
|
||||
import javax.swing.event.TreeSelectionEvent;
|
||||
import javax.swing.event.TreeSelectionListener;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
|
||||
import org.fife.ui.autocomplete.AutoCompletion;
|
||||
@@ -84,10 +69,7 @@ import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
||||
import org.fife.ui.rsyntaxtextarea.folding.CurlyFoldParser;
|
||||
import org.fife.ui.rsyntaxtextarea.folding.FoldParserManager;
|
||||
import org.fife.ui.rtextarea.RTextArea;
|
||||
import org.fife.ui.rtextarea.RTextScrollPane;
|
||||
import org.fife.ui.rtextarea.ToolTipSupplier;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
@@ -110,11 +92,18 @@ import me.ByteEdit.utils.UnicodeUtils;
|
||||
public class Main extends JFrame {
|
||||
|
||||
public static Main INSTANCE;
|
||||
|
||||
public static final Pattern patternSlash = Pattern.compile("/");
|
||||
private static final Pattern patternRenameableField = Pattern
|
||||
.compile("^\t(?:[a-z]+ |0x[0-9a-fA-F]+ )*?(\\[*(?:V|Z|C|B|S|I|F|J|D|L.+?;)) ([^ ]+) ?.*");
|
||||
private static final Pattern patternRenameableMethod = Pattern
|
||||
.compile("^\t(?:[a-z]+ |0x[0-9a-fA-F]+ )*?([^ ]+) (\\((?:\\[*(?:V|Z|C|B|S|I|F|J|D|L.+?;))*\\)[^ ]+) .*\\{");
|
||||
|
||||
private JPanel contentPane;
|
||||
private volatile boolean isChangingFile;
|
||||
public static File jarFile;
|
||||
public static HashMap<String, byte[]> OTHER_FILES = new HashMap<>();
|
||||
public static HashMap<String, ClassNode> classNodes = new HashMap<>();
|
||||
public static final HashMap<String, ClassNode> classNodes = new HashMap<>();
|
||||
public static final HashMap<String, byte[]> otherFiles = new HashMap<>();
|
||||
public static String currentNodeName;
|
||||
public static RSyntaxTextArea txtByteEditView;
|
||||
public static GlobalSearchBox globalSearchBox;
|
||||
@@ -128,7 +117,6 @@ public class Main extends JFrame {
|
||||
public static RTextScrollPane scrollPane_ByteEdit;
|
||||
public static File saveFolder;
|
||||
|
||||
private static final Pattern SLASH = Pattern.compile("/");
|
||||
private JMenuBar menuBar;
|
||||
private JMenu mnFile;
|
||||
private JMenuItem mntmOpenJar;
|
||||
@@ -158,6 +146,8 @@ public class Main extends JFrame {
|
||||
|
||||
public static final Object treeLock = new Object();
|
||||
|
||||
public static EnumDecompiler decompiler = EnumDecompiler.BYTEEDIT;
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
@@ -176,7 +166,7 @@ public class Main extends JFrame {
|
||||
/**
|
||||
* Create a simple provider that adds some Java-related completions.
|
||||
*/
|
||||
private CompletionProvider createCompletionProvider() {
|
||||
private static CompletionProvider createCompletionProvider() {
|
||||
DefaultCompletionProvider provider = new DefaultCompletionProvider();
|
||||
for (int i = 0; i < 200; i++) {
|
||||
String s = OpcodesReverse.reverseOpcode(i);
|
||||
@@ -298,7 +288,6 @@ public class Main extends JFrame {
|
||||
if (action == 0) {
|
||||
final File file = fileChooser.getSelectedFile();
|
||||
saveFolder = file.getParentFile();
|
||||
boolean shouldSave = false;
|
||||
if (file.exists()) {
|
||||
synchronized (treeLock) {
|
||||
jarFile = file;
|
||||
@@ -312,8 +301,9 @@ public class Main extends JFrame {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile));
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile), classNodes,
|
||||
otherFiles);
|
||||
EventQueue.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
synchronized (treeLock) {
|
||||
tree.setModel(model);
|
||||
@@ -330,7 +320,7 @@ public class Main extends JFrame {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -451,7 +441,7 @@ public class Main extends JFrame {
|
||||
new CurlyFoldParser(false, true));
|
||||
tree = new JTree(new DefaultTreeModel(null));
|
||||
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||
tree.addTreeExpansionListener(new FurtherExpandingTreeExpansionListener());
|
||||
tree.addTreeExpansionListener(new FurtherExpandingTreeExpansionListener(tree));
|
||||
tree.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
@@ -466,8 +456,9 @@ public class Main extends JFrame {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile));
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile), classNodes,
|
||||
otherFiles);
|
||||
EventQueue.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
synchronized (treeLock) {
|
||||
tree.setModel(model);
|
||||
@@ -476,7 +467,7 @@ public class Main extends JFrame {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -521,17 +512,8 @@ public class Main extends JFrame {
|
||||
}
|
||||
});
|
||||
scrollPane.setViewportView(tree);
|
||||
tree.addTreeSelectionListener(new TreeSelectionListener() {
|
||||
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
synchronized (treeLock) {
|
||||
if (!isChangingFile) {
|
||||
SingleThreadedExecutor.execute(
|
||||
() -> selectFile(((ByteEditTreeNode) e.getPath().getLastPathComponent()).path));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
tree.addTreeSelectionListener(e -> SingleThreadedExecutor
|
||||
.execute(() -> selectFile(((ByteEditTreeNode) e.getPath().getLastPathComponent()).path)));
|
||||
new DropTarget(tree, new DropTargetListener() {
|
||||
|
||||
@Override
|
||||
@@ -561,8 +543,9 @@ public class Main extends JFrame {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile));
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
ArchiveTreeModel model = new ArchiveTreeModel(new ZipFile(jarFile),
|
||||
classNodes, otherFiles);
|
||||
EventQueue.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
synchronized (treeLock) {
|
||||
tree.setModel(model);
|
||||
@@ -579,7 +562,7 @@ public class Main extends JFrame {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -618,84 +601,7 @@ public class Main extends JFrame {
|
||||
txtByteEditView = new RSyntaxTextArea();
|
||||
ac.install(txtByteEditView);
|
||||
txtByteEditView.setCodeFoldingEnabled(true);
|
||||
// ToolTips for HugeStrings
|
||||
txtByteEditView.setToolTipSupplier(new ToolTipSupplier() {
|
||||
|
||||
@Override
|
||||
public String getToolTipText(RTextArea textArea, MouseEvent e) {
|
||||
int idx = textArea.viewToModel(e.getPoint());
|
||||
if (idx < 0)
|
||||
return null;
|
||||
int subIdx = Math.max(idx - 15, 0);
|
||||
int subLen = Math.min(30, textArea.getDocument().getLength() - subIdx);
|
||||
if (subLen <= 0)
|
||||
return null;
|
||||
try {
|
||||
String cut = textArea.getText(subIdx, subLen);
|
||||
int hashIdx = -1;
|
||||
for (int off = idx - subIdx; off >= 0; off--) {
|
||||
if (cut.charAt(off) == '#') {
|
||||
hashIdx = off;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hashIdx < 0) {
|
||||
for (int off = idx - subIdx; off < cut.length(); off++) {
|
||||
if (cut.charAt(off) == '#') {
|
||||
hashIdx = off;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hashIdx < 0)
|
||||
return null;
|
||||
if (hashIdx >= 5 && cut.substring(hashIdx - 5, hashIdx).equals("ldc \"")) // ldc "#..."
|
||||
return null;
|
||||
int numLen = 1;
|
||||
for (int i = hashIdx + 1; i < cut.length(); i++) {
|
||||
if (!(cut.charAt(i) - '0' >= 0 && cut.charAt(i) - '0' <= 9)) {
|
||||
break;
|
||||
}
|
||||
numLen++;
|
||||
}
|
||||
if (numLen < 2 || hashIdx > idx - subIdx || idx - subIdx - numLen >= hashIdx)
|
||||
return null;
|
||||
String hashNum = cut.substring(hashIdx, hashIdx + numLen);
|
||||
|
||||
String txt = txtByteEditView.getText();
|
||||
int len = 0;
|
||||
for (String asm : txt.split("\\/\\/ #Annotations:\n")) {
|
||||
len += 19; // "\\/\\/ #Annotations:\n".length()
|
||||
if (asm.isEmpty())
|
||||
continue;
|
||||
if (idx >= len && idx < len + asm.length()) {
|
||||
try (BufferedReader reader = new BufferedReader(new StringReader(asm))) {
|
||||
String s;
|
||||
while (!(s = reader.readLine()).startsWith("// #SourceFile: ")) {
|
||||
}
|
||||
while (!(s = reader.readLine()).equals("// #Fields")) {
|
||||
if (s.startsWith("#")) {
|
||||
String[] split = Assembler.SPACE.split(s, 2);
|
||||
if (hashNum.equals(split[0].substring(0, split[0].length() - 1))) {
|
||||
String toolTip = split[1];
|
||||
if (toolTip.length() > 500)
|
||||
toolTip = toolTip.substring(0, 500) + "...";
|
||||
return toolTip;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
len += asm.length();
|
||||
}
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
txtByteEditView.setToolTipSupplier(new HugeStringsToolTips(txtByteEditView));
|
||||
txtByteEditView.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
@@ -737,24 +643,18 @@ public class Main extends JFrame {
|
||||
// specific
|
||||
tree.registerKeyboardAction(e -> save(), ctrlS, JComponent.WHEN_FOCUSED);
|
||||
txtByteEditView.registerKeyboardAction(e -> saveCurrentClassNode(), ctrlS, JComponent.WHEN_FOCUSED);
|
||||
txtByteEditView.registerKeyboardAction(e -> {
|
||||
try {
|
||||
renameSelected();
|
||||
} catch (BadLocationException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}, ctrlR, JComponent.WHEN_FOCUSED);
|
||||
txtByteEditView.registerKeyboardAction(e -> renameSelected(), ctrlR, JComponent.WHEN_FOCUSED);
|
||||
txtByteEditView.setEditable(true);
|
||||
txtByteEditView.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA_DISASSEMBLE);
|
||||
txtByteEditView.setCodeFoldingEnabled(true);
|
||||
scrollPane_ByteEdit = new RTextScrollPane();
|
||||
ThemeManager.registerTextArea(txtByteEditView);
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(scrollPane_ByteEdit, BorderLayout.CENTER);
|
||||
final JComboBox<String> decompilerMode = new JComboBox<>();
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
||||
Arrays.stream(EnumDecompiler.values()).forEach(model::addElement);
|
||||
Stream.of(EnumDecompiler.values()).forEach(model::addElement);
|
||||
decompilerMode.setModel(model);
|
||||
decompilerMode.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
@@ -767,12 +667,14 @@ public class Main extends JFrame {
|
||||
decompileCurrentNode();
|
||||
try {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
txtByteEditView.setCaretPosition(0);
|
||||
try {
|
||||
txtByteEditView.setSyntaxEditingStyle(decompiler.getSyntaxStyle());
|
||||
} catch (Throwable t) {
|
||||
synchronized (treeLock) {
|
||||
txtByteEditView.setCaretPosition(0);
|
||||
try {
|
||||
txtByteEditView.setSyntaxEditingStyle(decompiler.getSyntaxStyle());
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
txtByteEditView.setEditable(decompiler.isEditable());
|
||||
}
|
||||
txtByteEditView.setEditable(decompiler.isEditable());
|
||||
});
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
@@ -790,30 +692,27 @@ public class Main extends JFrame {
|
||||
scrollPane_ByteEdit.setFoldIndicatorEnabled(true);
|
||||
}
|
||||
|
||||
public static EnumDecompiler decompiler = EnumDecompiler.BYTEEDIT;
|
||||
|
||||
private final Pattern renameableFieldPattern = Pattern
|
||||
.compile("^\t(?:[a-z]+ |0x[0-9a-fA-F]+ )*?(\\[*(?:V|Z|C|B|S|I|F|J|D|L.+?;)) ([^ ]+) ?.*");
|
||||
private final Pattern renameableMethodPattern = Pattern
|
||||
.compile("^\t(?:[a-z]+ |0x[0-9a-fA-F]+ )*?([^ ]+) (\\((?:\\[*(?:V|Z|C|B|S|I|F|J|D|L.+?;))*\\)[^ ]+) .*\\{");
|
||||
|
||||
public void renameSelected() throws BadLocationException {
|
||||
int lineStart = txtByteEditView.getLineStartOffsetOfCurrentLine();
|
||||
int lineEnd = txtByteEditView.getLineEndOffsetOfCurrentLine() - 1;
|
||||
String line = txtByteEditView.getText(lineStart, lineEnd - lineStart);
|
||||
Matcher m = renameableFieldPattern.matcher(line);
|
||||
if (m.find()) {
|
||||
setRenameInfo(m, lineEnd);
|
||||
} else {
|
||||
m = renameableMethodPattern.matcher(line);
|
||||
public void renameSelected() {
|
||||
try {
|
||||
int lineStart = txtByteEditView.getLineStartOffsetOfCurrentLine();
|
||||
int lineEnd = txtByteEditView.getLineEndOffsetOfCurrentLine() - 1;
|
||||
String line = txtByteEditView.getText(lineStart, lineEnd - lineStart);
|
||||
Matcher m = patternRenameableField.matcher(line);
|
||||
if (m.find()) {
|
||||
if (ClassUtil.isObjectClassMethod(m.group(1), m.group(2), false)) {
|
||||
JOptionPane.showMessageDialog(null, "This method can not be renamed!", "Error!",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
setRenameInfo(m, lineEnd);
|
||||
} else {
|
||||
m = patternRenameableMethod.matcher(line);
|
||||
if (m.find()) {
|
||||
if (ClassUtil.isObjectClassMethod(m.group(1), m.group(2), false)) {
|
||||
JOptionPane.showMessageDialog(null, "This method can not be renamed!", "Error!",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
setRenameInfo(m, lineEnd);
|
||||
}
|
||||
}
|
||||
} catch (BadLocationException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,9 +737,9 @@ public class Main extends JFrame {
|
||||
String[] split = s.split(" ");
|
||||
String className = UnicodeUtils.unescape(null, split[split.length - 1], true);
|
||||
renameBox.className = className;
|
||||
String name = UnicodeUtils.unescape(null, m.pattern() == renameableFieldPattern ? m.group(2) : m.group(1),
|
||||
String name = UnicodeUtils.unescape(null, m.pattern() == patternRenameableField ? m.group(2) : m.group(1),
|
||||
true);
|
||||
String desc = UnicodeUtils.unescape(null, m.pattern() == renameableFieldPattern ? m.group(1) : m.group(2),
|
||||
String desc = UnicodeUtils.unescape(null, m.pattern() == patternRenameableField ? m.group(1) : m.group(2),
|
||||
true);
|
||||
renameBox.name = name;
|
||||
renameBox.desc = desc;
|
||||
@@ -851,7 +750,7 @@ public class Main extends JFrame {
|
||||
}
|
||||
}
|
||||
|
||||
private void saveCurrentClassNode() {
|
||||
private static void saveCurrentClassNode() {
|
||||
String txt = txtByteEditView.getText();
|
||||
for (String s : txt.split("\\/\\/ #Annotations:\n")) {
|
||||
if (s.isEmpty())
|
||||
@@ -864,7 +763,7 @@ public class Main extends JFrame {
|
||||
classNodes.put(getFullName(node.name), node);
|
||||
ArchiveTreeModel model;
|
||||
if (tree.getModel().getClass().equals(DefaultTreeModel.class)) {
|
||||
tree.setModel(model = new ArchiveTreeModel());
|
||||
tree.setModel(model = new ArchiveTreeModel(classNodes, otherFiles));
|
||||
} else {
|
||||
model = (ArchiveTreeModel) tree.getModel();
|
||||
}
|
||||
@@ -890,18 +789,23 @@ public class Main extends JFrame {
|
||||
String dis = decompiler.getDecompiler().decompile(classNode);
|
||||
String substr = current.substring(0, current.length() - 6);
|
||||
synchronized (Main.classNodes) {
|
||||
for (String key : Main.classNodes.keySet()) {
|
||||
if (key.contains("$")) {
|
||||
String[] split = key.split("\\$");
|
||||
for (Entry<String, ClassNode> entry : Main.classNodes.entrySet()) {
|
||||
if (entry.getKey().contains("$")) {
|
||||
String[] split = entry.getKey().split("\\$");
|
||||
if (split[0].equals(substr)) {
|
||||
dis += "\n" + decompiler.getDecompiler().decompile(classNodes.get(key));
|
||||
dis += "\n" + decompiler.getDecompiler().decompile(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
txtByteEditView.setText(dis);
|
||||
if (dis.length() > prev)
|
||||
txtByteEditView.setCaretPosition(prev);
|
||||
String fdis = dis;
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
synchronized (treeLock) {
|
||||
txtByteEditView.setText(fdis);
|
||||
if (fdis.length() > prev)
|
||||
txtByteEditView.setCaretPosition(prev);
|
||||
}
|
||||
});
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
@@ -960,14 +864,18 @@ public class Main extends JFrame {
|
||||
public void run() {
|
||||
synchronized (treeLock) {
|
||||
save(file, classNodes.values());
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
synchronized (treeLock) {
|
||||
isChangingFile = false;
|
||||
Main.this.setTitle("ByteEdit");
|
||||
try {
|
||||
EventQueue.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
synchronized (treeLock) {
|
||||
isChangingFile = false;
|
||||
Main.this.setTitle("ByteEdit");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
@@ -1000,12 +908,12 @@ public class Main extends JFrame {
|
||||
if (name != null && !name.isEmpty()) {
|
||||
String val = "Manifest-Version: 1.0\n" + "Class-Path: .\n" + "Main-Class: " + name.replace('/', '.')
|
||||
+ "\n\n";
|
||||
OTHER_FILES.put("META-INF/MANIFEST.MF", val.getBytes());
|
||||
otherFiles.put("META-INF/MANIFEST.MF", val.getBytes());
|
||||
}
|
||||
if (tree.getModel() instanceof ArchiveTreeModel)
|
||||
((ArchiveTreeModel) tree.getModel()).newCreated = false;
|
||||
}
|
||||
for (Entry<String, byte[]> entry : OTHER_FILES.entrySet()) {
|
||||
for (Entry<String, byte[]> entry : otherFiles.entrySet()) {
|
||||
ZipEntry ent = new ZipEntry(entry.getKey());
|
||||
output.putNextEntry(ent);
|
||||
output.write(entry.getValue());
|
||||
@@ -1051,187 +959,4 @@ public class Main extends JFrame {
|
||||
public static String getFullName(String s) {
|
||||
return s + ".class";
|
||||
}
|
||||
|
||||
class ArchiveTreeModel extends DefaultTreeModel {
|
||||
|
||||
public ArrayList<String> paths = new ArrayList<>();
|
||||
public boolean newCreated = false;
|
||||
|
||||
public ArchiveTreeModel() {
|
||||
super(new ByteEditTreeNode("New"));
|
||||
newCreated = true;
|
||||
}
|
||||
|
||||
public ArchiveTreeModel(ZipFile jar) {
|
||||
super(new ByteEditTreeNode(jar.getName().split(File.separator.equals("\\") ? "\\\\"
|
||||
: File.separator)[jar.getName().split(File.separator.equals("\\") ? "\\\\" : File.separator).length
|
||||
- 1]));
|
||||
try {
|
||||
classNodes.clear();
|
||||
OTHER_FILES.clear();
|
||||
Enumeration<? extends ZipEntry> enumeration = jar.entries();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
ZipEntry next = enumeration.nextElement();
|
||||
byte[] data = toByteArray(jar.getInputStream(next));
|
||||
if (next.getSize() != 0 && !next.getName().startsWith("META-INF")
|
||||
&& (next.getName().endsWith(".class") || next.getName().endsWith(".class/"))) {
|
||||
try {
|
||||
ClassReader reader = new ClassReader(data);
|
||||
ClassNode node = new ClassNode();
|
||||
reader.accept(node, 0);
|
||||
classNodes.put(getFullName(node.name), node);
|
||||
|
||||
if ((next.getName().contains("/")
|
||||
? (!SLASH.split(next.getName())[SLASH.split(next.getName()).length - 1]
|
||||
.contains("$"))
|
||||
: (!next.getName().contains("$")))
|
||||
|| (next.getName().startsWith("$") || next.getName().contains("$$")
|
||||
|| next.getName().endsWith("$"))) {
|
||||
paths.add(getFullName(node.name));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
OTHER_FILES.put(next.getName(), data);
|
||||
}
|
||||
} else {
|
||||
OTHER_FILES.put(next.getName(), data);
|
||||
}
|
||||
}
|
||||
jar.close();
|
||||
refresh();
|
||||
} catch (Throwable e) {
|
||||
classNodes.clear();
|
||||
OTHER_FILES.clear();
|
||||
e.printStackTrace();
|
||||
showError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private int getSlashCount(String s) {
|
||||
int count = 0;
|
||||
for (char c : s.toCharArray()) {
|
||||
if (c == '/')
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
setRoot(new ByteEditTreeNode(((ByteEditTreeNode) getRoot()).toString()));
|
||||
Collections.sort(paths, String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(paths, new Comparator<String>() {
|
||||
public int compare(String s1, String s2) {
|
||||
return getSlashCount(s2) - getSlashCount(s1);
|
||||
}
|
||||
});
|
||||
|
||||
// Windows-like sorting (like file explorer)
|
||||
List<String> tmp = new ArrayList<>(paths);
|
||||
|
||||
List<String> folders = tmp.stream().filter(s -> {
|
||||
int c = countSlashes(s, 50);
|
||||
return c > 0 && c < 50;
|
||||
}).map(s -> {
|
||||
int idx = s.lastIndexOf('/');
|
||||
if (idx == s.length() - 1)
|
||||
idx = s.lastIndexOf('/', idx - 1);
|
||||
if (idx == -1)
|
||||
return s;
|
||||
return s.substring(0, idx);
|
||||
}).distinct().sorted(new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String s, String s2) {
|
||||
// From String#compareToIgnoreCase(String)
|
||||
int n = s.length();
|
||||
int n2 = s2.length();
|
||||
int n3 = Math.min(n, n2);
|
||||
for (int i = 0; i < n3; ++i) {
|
||||
char c;
|
||||
char c2 = s.charAt(i);
|
||||
if (c2 == (c = s2.charAt(i))
|
||||
|| (c2 = Character.toUpperCase(c2)) == (c = Character.toUpperCase(c))
|
||||
|| (c2 = Character.toLowerCase(c2)) == (c = Character.toLowerCase(c)))
|
||||
continue;
|
||||
return c2 - c;
|
||||
}
|
||||
// Other way around
|
||||
return n2 - n;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
tmp.removeAll(folders);
|
||||
tmp.addAll(0, folders);
|
||||
|
||||
for (String s : tmp) {
|
||||
String[] elements = SLASH.split(s, 50);
|
||||
if (elements.length >= 50) {
|
||||
((ByteEditTreeNode) getRoot()).add(new ByteEditTreeNode(s, s));
|
||||
} else {
|
||||
ByteEditTreeNode currentNode = (ByteEditTreeNode) getRoot();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
String token = elements[i];
|
||||
ByteEditTreeNode nextNode = findNode(currentNode, token);
|
||||
if (nextNode == null) {
|
||||
nextNode = new ByteEditTreeNode(token, s);
|
||||
currentNode.add(nextNode);
|
||||
}
|
||||
currentNode = nextNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ByteEditTreeNode findNode(ByteEditTreeNode parent, String name) {
|
||||
Enumeration<?> e = parent.children();
|
||||
while (e.hasMoreElements()) {
|
||||
ByteEditTreeNode element = (ByteEditTreeNode) e.nextElement();
|
||||
if (element.getUserObject().equals(name)) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int countSlashes(String s, int max) {
|
||||
int count = 0;
|
||||
for (char c : s.toCharArray()) {
|
||||
if (c == '/') {
|
||||
count++;
|
||||
if (count == max)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
private static class FurtherExpandingTreeExpansionListener implements TreeExpansionListener {
|
||||
public void treeExpanded(TreeExpansionEvent event) {
|
||||
TreePath treePath = event.getPath();
|
||||
Object expandedTreePathObject = treePath.getLastPathComponent();
|
||||
if (!(expandedTreePathObject instanceof TreeNode))
|
||||
return;
|
||||
TreeNode expandedTreeNode = (TreeNode) expandedTreePathObject;
|
||||
if (expandedTreeNode.getChildCount() == 1) {
|
||||
TreeNode descendantTreeNode = expandedTreeNode.getChildAt(0);
|
||||
if (descendantTreeNode.isLeaf())
|
||||
return;
|
||||
TreePath nextTreePath = treePath.pathByAddingChild(descendantTreeNode);
|
||||
tree.expandPath(nextTreePath);
|
||||
}
|
||||
}
|
||||
|
||||
public void treeCollapsed(TreeExpansionEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] toByteArray(final InputStream input) throws IOException {
|
||||
try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int read;
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
return output.toByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,11 +320,9 @@ public class ClassUtil {
|
||||
s += "enum ";
|
||||
acc ^= ACC_ENUM;
|
||||
}
|
||||
if (acc == access) {
|
||||
if (acc == access)
|
||||
return s;
|
||||
} else {
|
||||
return "0x" + Integer.toHexString(access) + " ";
|
||||
}
|
||||
return "0x" + Integer.toHexString(access) + " ";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -544,8 +542,7 @@ public class ClassUtil {
|
||||
DecompilationInterface di = diMap.get(o.getClass());
|
||||
if (di != null)
|
||||
return di.apply(o, desc, escapeSpaces, hs);
|
||||
else
|
||||
return o.toString();
|
||||
return o.toString();
|
||||
}
|
||||
|
||||
public static String getDecompiledValue(Object o, String desc, HugeStrings hs) {
|
||||
|
||||
@@ -84,11 +84,9 @@ public class UnicodeUtils {
|
||||
sb.append(c);
|
||||
}
|
||||
if (stage != 0) {
|
||||
if (unicodeBuffer != 0) {
|
||||
if (unicodeBuffer != 0)
|
||||
throw new IllegalArgumentException("The unicode at the end is incomplete.");
|
||||
} else {
|
||||
throw new IllegalArgumentException("'\\' at the end is invalid.");
|
||||
}
|
||||
throw new IllegalArgumentException("'\\' at the end is invalid.");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -1,495 +0,0 @@
|
||||
/*
|
||||
* 04/27/2010
|
||||
*
|
||||
* ActionScriptTokenMaker.java - Scanner for ActionScript.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the ActionScript.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>ActionScriptTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class ActionScriptTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public ActionScriptTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
AnyCharacterButApostropheOrBackSlash = ([^\\'])
|
||||
AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
CharLiteral = ([\']({AnyCharacterButApostropheOrBackSlash}|{Escape})*[\'])
|
||||
UnclosedCharLiteral = ([\']([\\].|[^\\\'])*[^\']*)
|
||||
ErrorCharLiteral = ({UnclosedCharLiteral}[\'])
|
||||
StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"])
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
MLCBegin = ("/*")
|
||||
MLCEnd = ("*/")
|
||||
LineCommentBegin = ("//")
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator})
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state MLC
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"add" |
|
||||
"and" |
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"const" |
|
||||
"continue" |
|
||||
"default" |
|
||||
"delete" |
|
||||
"do" |
|
||||
"dynamic" |
|
||||
"else" |
|
||||
"eq" |
|
||||
"extends" |
|
||||
"final" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"for each" |
|
||||
"function" |
|
||||
"ge" |
|
||||
"get" |
|
||||
"gt" |
|
||||
"if" |
|
||||
"ifFrameLoaded" |
|
||||
"implements" |
|
||||
"import" |
|
||||
"in" |
|
||||
"include" |
|
||||
"interface" |
|
||||
"internal" |
|
||||
"label" |
|
||||
"le" |
|
||||
"lt" |
|
||||
"namespace" |
|
||||
"native" |
|
||||
"ne" |
|
||||
"new" |
|
||||
"not" |
|
||||
"on" |
|
||||
"onClipEvent" |
|
||||
"or" |
|
||||
"override" |
|
||||
"package" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"return" |
|
||||
"set" |
|
||||
"static" |
|
||||
"super" |
|
||||
"switch" |
|
||||
"tellTarget" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try" |
|
||||
"typeof" |
|
||||
"use" |
|
||||
"var" |
|
||||
"void" |
|
||||
"while" |
|
||||
"with" |
|
||||
|
||||
"null" |
|
||||
"undefined" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Built-in objects (good idea not to use these names!) */
|
||||
"Array" |
|
||||
"Boolean" |
|
||||
"Color" |
|
||||
"Date" |
|
||||
"Function" |
|
||||
"int" |
|
||||
"Key" |
|
||||
"MovieClip" |
|
||||
"Math" |
|
||||
"Mouse" |
|
||||
"Null" |
|
||||
"Number" |
|
||||
"Object" |
|
||||
"Selection" |
|
||||
"Sound" |
|
||||
"String" |
|
||||
"uint" |
|
||||
"Vector" |
|
||||
"XML" |
|
||||
"XMLNode" |
|
||||
"XMLSocket" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Global functions */
|
||||
"call" |
|
||||
"escape" |
|
||||
"eval" |
|
||||
"fscommand" |
|
||||
"getProperty" |
|
||||
"getTimer" |
|
||||
"getURL" |
|
||||
"getVersion" |
|
||||
"gotoAndPlay" |
|
||||
"gotoAndStop" |
|
||||
"#include" |
|
||||
"int" |
|
||||
"isFinite" |
|
||||
"isNaN" |
|
||||
"loadMovie" |
|
||||
"loadMovieNum" |
|
||||
"loadVariables" |
|
||||
"loadVariablesNum" |
|
||||
"maxscroll" |
|
||||
"newline" |
|
||||
"nextFrame" |
|
||||
"nextScene" |
|
||||
"Number" |
|
||||
"parseFloat" |
|
||||
"parseInt" |
|
||||
"play" |
|
||||
"prevFrame" |
|
||||
"prevScene" |
|
||||
"print" |
|
||||
"printAsBitmap" |
|
||||
"printAsBitmapNum" |
|
||||
"printNum" |
|
||||
"random" |
|
||||
"removeMovieClip" |
|
||||
"scroll" |
|
||||
"setProperty" |
|
||||
"startDrag" |
|
||||
"stop" |
|
||||
"stopAllSounds" |
|
||||
"stopDrag" |
|
||||
"String" |
|
||||
"targetPath" |
|
||||
"tellTarget" |
|
||||
"toggleHighQuality" |
|
||||
"trace" |
|
||||
"unescape" |
|
||||
"unloadMovie" |
|
||||
"unloadMovieNum" |
|
||||
"updateAfterEvent" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Booleans. */
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{ErrorCharLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,273 +0,0 @@
|
||||
/*
|
||||
* 11/18/2009
|
||||
*
|
||||
* BBCodeTokenMaker.java - Generates tokens for BBCode syntax highlighting.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for BBCode.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>BBCodeTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.7
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class BBCodeTokenMaker
|
||||
%extends AbstractMarkupTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specific to BBCodeTokenMaker; this signals that the user has
|
||||
* ended a line with an unclosed tag; thus a new line is beginning
|
||||
* still inside of the tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG = -1;
|
||||
|
||||
/**
|
||||
* Whether closing markup tags are automatically completed for BBCode.
|
||||
*/
|
||||
private static boolean completeCloseTags = true;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public BBCodeTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether markup close tags should be completed. The default value
|
||||
* for BBCode is <code>true</code>.
|
||||
*
|
||||
* @return Whether closing markup tags are completed.
|
||||
* @see #setCompleteCloseTags(boolean)
|
||||
*/
|
||||
@Override
|
||||
public boolean getCompleteCloseTags() {
|
||||
return completeCloseTags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <code>null</code> since BBCode has no comments.
|
||||
*
|
||||
* @return <code>null</code> always.
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_INTAG:
|
||||
state = INTAG;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether markup close tags should be completed.
|
||||
*
|
||||
* @param complete Whether closing markup tags are completed.
|
||||
* @see #getCompleteCloseTags()
|
||||
*/
|
||||
public static void setCompleteCloseTags(boolean complete) {
|
||||
completeCloseTags = complete;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Whitespace = ([ \t\f]+)
|
||||
LineTerminator = ([\n])
|
||||
Identifier = ([^ \t\f\n\[]+)
|
||||
InTagIdentifier = ([^ \t\f\n\[\]\/\=]+)
|
||||
Tag = ("b"|"i"|"u"|"s"|"size"|"color"|"center"|"quote"|"url"|"img"|"ul"|"li"|"ol"|"youtube"|"gvideo")
|
||||
|
||||
%state INTAG
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
"[" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG); }
|
||||
"[/" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG); }
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG> {
|
||||
"/" { addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
{Tag} { addToken(Token.MARKUP_TAG_NAME); }
|
||||
{InTagIdentifier} { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
"/]" { yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
"]" { yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
. { addToken(Token.IDENTIFIER); /* Unhandled chars, not likely */ }
|
||||
<<EOF>> { addToken(zzMarkedPos,zzMarkedPos, INTERNAL_INTAG); return firstToken; }
|
||||
}
|
||||
@@ -1,660 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 11/18/09 4:41 PM */
|
||||
/*
|
||||
* 11/18/2009
|
||||
* BBCodeTokenMaker.java - Generates tokens for BBCode syntax highlighting.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for BBCode.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>BBCodeTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.7
|
||||
*
|
||||
*/
|
||||
public class BBCodeTokenMaker extends AbstractMarkupTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int INTAG = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\1\1\2\1\0\1\1\23\0\1\1\16\0\1\27\15\0"
|
||||
+ "\1\30\35\0\1\3\1\0\1\4\4\0\1\5\1\13\1\26\1\12" + "\1\0\1\23\1\0\1\6\2\0\1\15\1\22\1\17\1\14\1\0"
|
||||
+ "\1\21\1\16\1\10\1\20\1\7\1\25\2\0\1\24\1\11\uff85\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\2\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"
|
||||
+ "\4\10\6\5\1\11\1\12\1\4\23\5";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[41];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\31\0\62\0\113\0\144\0\175\0\226\0\144"
|
||||
+ "\0\144\0\226\0\257\0\310\0\341\0\372\0\u0113\0\u012c"
|
||||
+ "\0\u0145\0\u015e\0\u0177\0\u0190\0\144\0\144\0\u01a9\0\u01c2"
|
||||
+ "\0\u01db\0\u01f4\0\u020d\0\u0226\0\u023f\0\u0258\0\u0271\0\u028a"
|
||||
+ "\0\u02a3\0\u02bc\0\u02d5\0\u02ee\0\u0307\0\u0320\0\u0339\0\u0352" + "\0\u036b";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[41];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\1\5\1\6\25\3\1\7\1\4\1\0"
|
||||
+ "\1\10\1\11\1\12\1\13\1\14\1\15\2\7\1\16" + "\1\17\1\20\3\7\1\21\1\7\1\22\1\23\2\7"
|
||||
+ "\1\24\1\25\1\3\3\0\25\3\1\0\1\4\107\0" + "\1\26\1\0\1\7\4\0\22\7\2\0\1\7\4\0"
|
||||
+ "\15\7\1\27\4\7\2\0\1\7\4\0\10\7\1\12" + "\1\17\10\7\2\0\1\7\4\0\1\7\1\30\20\7"
|
||||
+ "\2\0\1\7\4\0\5\7\1\31\1\7\1\32\12\7" + "\2\0\1\7\4\0\10\7\1\12\11\7\2\0\1\7"
|
||||
+ "\4\0\1\7\1\12\20\7\2\0\1\7\4\0\2\7" + "\1\33\17\7\2\0\1\7\4\0\20\7\1\34\1\7"
|
||||
+ "\2\0\1\7\4\0\7\7\1\35\12\7\6\0\1\11" + "\24\0\1\7\4\0\16\7\1\12\3\7\2\0\1\7"
|
||||
+ "\4\0\4\7\1\36\15\7\2\0\1\7\4\0\12\7" + "\1\37\7\7\2\0\1\7\4\0\10\7\1\40\11\7"
|
||||
+ "\2\0\1\7\4\0\7\7\1\41\12\7\2\0\1\7" + "\4\0\1\7\1\42\20\7\2\0\1\7\4\0\2\7"
|
||||
+ "\1\43\17\7\2\0\1\7\4\0\5\7\1\12\14\7" + "\2\0\1\7\4\0\13\7\1\44\6\7\2\0\1\7"
|
||||
+ "\4\0\7\7\1\45\12\7\2\0\1\7\4\0\13\7" + "\1\36\6\7\2\0\1\7\4\0\21\7\1\46\2\0"
|
||||
+ "\1\7\4\0\13\7\1\47\6\7\2\0\1\7\4\0" + "\5\7\1\45\14\7\2\0\1\7\4\0\11\7\1\12"
|
||||
+ "\10\7\2\0\1\7\4\0\5\7\1\50\14\7\2\0" + "\1\7\4\0\2\7\1\51\17\7\2\0\1\7\4\0"
|
||||
+ "\7\7\1\12\12\7\2\0\1\7\4\0\1\36\21\7" + "\2\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[900];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\2\1\1\11\2\1\2\11\13\1\2\11\23\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[41];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
/**
|
||||
* Token type specific to BBCodeTokenMaker; this signals that the user has ended
|
||||
* a line with an unclosed tag; thus a new line is beginning still inside of the
|
||||
* tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG = -1;
|
||||
/**
|
||||
* Whether closing markup tags are automatically completed for BBCode.
|
||||
*/
|
||||
private static boolean completeCloseTags = true;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public BBCodeTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether markup close tags should be completed. The default value for
|
||||
* BBCode is <code>true</code>.
|
||||
*
|
||||
* @return Whether closing markup tags are completed.
|
||||
* @see #setCompleteCloseTags(boolean)
|
||||
*/
|
||||
@Override
|
||||
public boolean getCompleteCloseTags() {
|
||||
return completeCloseTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>null</code> since BBCode has no comments.
|
||||
*
|
||||
* @return <code>null</code> always.
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_INTAG:
|
||||
state = INTAG;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether markup close tags should be completed.
|
||||
*
|
||||
* @param complete Whether closing markup tags are completed.
|
||||
* @see #getCompleteCloseTags()
|
||||
*/
|
||||
public static void setCompleteCloseTags(boolean complete) {
|
||||
completeCloseTags = complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public BBCodeTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public BBCodeTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 80) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 11:
|
||||
break;
|
||||
case 9: {
|
||||
addToken(Token.MARKUP_TAG_DELIMITER);
|
||||
}
|
||||
case 12:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 13:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 14:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.MARKUP_TAG_NAME);
|
||||
}
|
||||
case 15:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.MARKUP_TAG_DELIMITER);
|
||||
yybegin(INTAG);
|
||||
}
|
||||
case 16:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.IDENTIFIER); /* Unhandled chars, not likely */
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.MARKUP_TAG_ATTRIBUTE);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 3: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 7: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(Token.MARKUP_TAG_DELIMITER);
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case INTAG: {
|
||||
addToken(zzMarkedPos, zzMarkedPos, INTERNAL_INTAG);
|
||||
return firstToken;
|
||||
}
|
||||
case 42:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 43:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,685 +0,0 @@
|
||||
/*
|
||||
* 11/19/2004
|
||||
*
|
||||
* CPlusPlusTokenMaker.java - An object that can take a chunk of text and
|
||||
* return a linked list of tokens representing it in C++.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* A parser for the C++ programming language.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>CPlusPlusTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.6
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class CPlusPlusTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public CPlusPlusTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_EOL:
|
||||
state = EOL_COMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = YYINITIAL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
Digit = [0-9]
|
||||
HexDigit = {Digit}|[A-Fa-f]
|
||||
OctalDigit = [0-7]
|
||||
Exponent = [eE][+-]?{Digit}+
|
||||
|
||||
PreprocessorWord = define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef
|
||||
|
||||
Trigraph = ("??="|"??("|"??)"|"??/"|"??'"|"??<"|"??>"|"??!"|"??-")
|
||||
|
||||
OctEscape1 = ([\\]{OctalDigit})
|
||||
OctEscape2 = ([\\]{OctalDigit}{OctalDigit})
|
||||
OctEscape3 = ([\\][0-3]{OctalDigit}{OctalDigit})
|
||||
OctEscape = ({OctEscape1}|{OctEscape2}|{OctEscape3})
|
||||
HexEscape = ([\\][xX]{HexDigit}{HexDigit})
|
||||
|
||||
AnyChrChr = ([^\'\n\\])
|
||||
Escape = ([\\]([abfnrtv\'\"\?\\0e]))
|
||||
UnclosedCharLiteral = ([\']({Escape}|{OctEscape}|{HexEscape}|{Trigraph}|{AnyChrChr}))
|
||||
CharLiteral = ({UnclosedCharLiteral}[\'])
|
||||
ErrorUnclosedCharLiteral = ([\'][^\'\n]*)
|
||||
ErrorCharLiteral = (([\'][\'])|{ErrorUnclosedCharLiteral}[\'])
|
||||
AnyStrChr = ([^\"\n\\])
|
||||
FalseTrigraph = (("?"(("?")*)[^\=\(\)\/\'\<\>\!\-\\\?\"\n])|("?"[\=\(\)\/\'\<\>\!\-]))
|
||||
StringLiteral = ([\"]((((("?")*)({Escape}|{OctEscape}|{HexEscape}|{Trigraph}))|{FalseTrigraph}|{AnyStrChr})*)(("?")*)[\"])
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
|
||||
LineTerminator = \n
|
||||
WhiteSpace = [ \t\f]
|
||||
|
||||
MLCBegin = "/*"
|
||||
MLCEnd = "*/"
|
||||
LineCommentBegin = "//"
|
||||
|
||||
NonFloatSuffix = (([uU][lL]?)|([lL][uU]?))
|
||||
IntegerLiteral = ({Digit}+{Exponent}?{NonFloatSuffix}?)
|
||||
HexLiteral = ("0"[xX]{HexDigit}+{NonFloatSuffix}?)
|
||||
FloatLiteral = ((({Digit}*[\.]{Digit}+)|({Digit}+[\.]{Digit}*)){Exponent}?[fFlL]?)
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#")
|
||||
Identifier = ({LetterOrUnderscore}({LetterOrUnderscore}|{Digit}|[$])*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state MLC
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"auto" |
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"const" |
|
||||
"const_cast" |
|
||||
"continue" |
|
||||
"default" |
|
||||
"delete" |
|
||||
"do" |
|
||||
"dynamic_cast" |
|
||||
"else" |
|
||||
"enum" |
|
||||
"explicit" |
|
||||
"extern" |
|
||||
"for" |
|
||||
"friend" |
|
||||
"goto" |
|
||||
"if" |
|
||||
"inline" |
|
||||
"mutable" |
|
||||
"namespace" |
|
||||
"new" |
|
||||
"operator" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"register" |
|
||||
"reinterpret_cast" |
|
||||
"sizeof" |
|
||||
"static" |
|
||||
"static_cast" |
|
||||
"struct" |
|
||||
"switch" |
|
||||
"template" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try" |
|
||||
"typedef" |
|
||||
"typeid" |
|
||||
"typename" |
|
||||
"union" |
|
||||
"using" |
|
||||
"virtual" |
|
||||
"volatile" |
|
||||
"while" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
/* Boolean literals. */
|
||||
"true" |
|
||||
"false" |
|
||||
|
||||
/* Data types. */
|
||||
"char" |
|
||||
"div_t" |
|
||||
"double" |
|
||||
"float" |
|
||||
"int" |
|
||||
"ldiv_t" |
|
||||
"long" |
|
||||
"short" |
|
||||
"signed" |
|
||||
"size_t" |
|
||||
"unsigned" |
|
||||
"void" |
|
||||
"wchar_t" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Standard functions */
|
||||
"abort" |
|
||||
"abs" |
|
||||
"acos" |
|
||||
"asctime" |
|
||||
"asin" |
|
||||
"assert" |
|
||||
"atan2" |
|
||||
"atan" |
|
||||
"atexit" |
|
||||
"atof" |
|
||||
"atoi" |
|
||||
"atol" |
|
||||
"bsearch" |
|
||||
"btowc" |
|
||||
"calloc" |
|
||||
"ceil" |
|
||||
"clearerr" |
|
||||
"clock" |
|
||||
"cosh" |
|
||||
"cos" |
|
||||
"ctime" |
|
||||
"difftime" |
|
||||
"div" |
|
||||
"errno" |
|
||||
"exit" |
|
||||
"exp" |
|
||||
"fabs" |
|
||||
"fclose" |
|
||||
"feof" |
|
||||
"ferror" |
|
||||
"fflush" |
|
||||
"fgetc" |
|
||||
"fgetpos" |
|
||||
"fgetwc" |
|
||||
"fgets" |
|
||||
"fgetws" |
|
||||
"floor" |
|
||||
"fmod" |
|
||||
"fopen" |
|
||||
"fprintf" |
|
||||
"fputc" |
|
||||
"fputs" |
|
||||
"fputwc" |
|
||||
"fputws" |
|
||||
"fread" |
|
||||
"free" |
|
||||
"freopen" |
|
||||
"frexp" |
|
||||
"fscanf" |
|
||||
"fseek" |
|
||||
"fsetpos" |
|
||||
"ftell" |
|
||||
"fwprintf" |
|
||||
"fwrite" |
|
||||
"fwscanf" |
|
||||
"getchar" |
|
||||
"getc" |
|
||||
"getenv" |
|
||||
"gets" |
|
||||
"getwc" |
|
||||
"getwchar" |
|
||||
"gmtime" |
|
||||
"isalnum" |
|
||||
"isalpha" |
|
||||
"iscntrl" |
|
||||
"isdigit" |
|
||||
"isgraph" |
|
||||
"islower" |
|
||||
"isprint" |
|
||||
"ispunct" |
|
||||
"isspace" |
|
||||
"isupper" |
|
||||
"isxdigit" |
|
||||
"labs" |
|
||||
"ldexp" |
|
||||
"ldiv" |
|
||||
"localeconv" |
|
||||
"localtime" |
|
||||
"log10" |
|
||||
"log" |
|
||||
"longjmp" |
|
||||
"malloc" |
|
||||
"mblen" |
|
||||
"mbrlen" |
|
||||
"mbrtowc" |
|
||||
"mbsinit" |
|
||||
"mbsrtowcs" |
|
||||
"mbstowcs" |
|
||||
"mbtowc" |
|
||||
"memchr" |
|
||||
"memcmp" |
|
||||
"memcpy" |
|
||||
"memmove" |
|
||||
"memset" |
|
||||
"mktime" |
|
||||
"modf" |
|
||||
"offsetof" |
|
||||
"perror" |
|
||||
"pow" |
|
||||
"printf" |
|
||||
"putchar" |
|
||||
"putc" |
|
||||
"puts" |
|
||||
"putwc" |
|
||||
"putwchar" |
|
||||
"qsort" |
|
||||
"raise" |
|
||||
"rand" |
|
||||
"realloc" |
|
||||
"remove" |
|
||||
"rename" |
|
||||
"rewind" |
|
||||
"scanf" |
|
||||
"setbuf" |
|
||||
"setjmp" |
|
||||
"setlocale" |
|
||||
"setvbuf" |
|
||||
"setvbuf" |
|
||||
"signal" |
|
||||
"sinh" |
|
||||
"sin" |
|
||||
"sprintf" |
|
||||
"sqrt" |
|
||||
"srand" |
|
||||
"sscanf" |
|
||||
"strcat" |
|
||||
"strchr" |
|
||||
"strcmp" |
|
||||
"strcmp" |
|
||||
"strcoll" |
|
||||
"strcpy" |
|
||||
"strcspn" |
|
||||
"strerror" |
|
||||
"strftime" |
|
||||
"strlen" |
|
||||
"strncat" |
|
||||
"strncmp" |
|
||||
"strncpy" |
|
||||
"strpbrk" |
|
||||
"strrchr" |
|
||||
"strspn" |
|
||||
"strstr" |
|
||||
"strtod" |
|
||||
"strtok" |
|
||||
"strtol" |
|
||||
"strtoul" |
|
||||
"strxfrm" |
|
||||
"swprintf" |
|
||||
"swscanf" |
|
||||
"system" |
|
||||
"tanh" |
|
||||
"tan" |
|
||||
"time" |
|
||||
"tmpfile" |
|
||||
"tmpnam" |
|
||||
"tolower" |
|
||||
"toupper" |
|
||||
"ungetc" |
|
||||
"ungetwc" |
|
||||
"va_arg" |
|
||||
"va_end" |
|
||||
"va_start" |
|
||||
"vfprintf" |
|
||||
"vfwprintf" |
|
||||
"vprintf" |
|
||||
"vsprintf" |
|
||||
"vswprintf" |
|
||||
"vwprintf" |
|
||||
"wcrtomb" |
|
||||
"wcscat" |
|
||||
"wcschr" |
|
||||
"wcscmp" |
|
||||
"wcscoll" |
|
||||
"wcscpy" |
|
||||
"wcscspn" |
|
||||
"wcsftime" |
|
||||
"wcslen" |
|
||||
"wcsncat" |
|
||||
"wcsncmp" |
|
||||
"wcsncpy" |
|
||||
"wcspbrk" |
|
||||
"wcsrchr" |
|
||||
"wcsrtombs" |
|
||||
"wcsspn" |
|
||||
"wcsstr" |
|
||||
"wcstod" |
|
||||
"wcstok" |
|
||||
"wcstol" |
|
||||
"wcstombs" |
|
||||
"wcstoul" |
|
||||
"wcsxfrm" |
|
||||
"wctob" |
|
||||
"wctomb" |
|
||||
"wmemchr" |
|
||||
"wmemcmp" |
|
||||
"wmemcpy" |
|
||||
"wmemmove" |
|
||||
"wmemset" |
|
||||
"wprintf" |
|
||||
"wscanf" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Standard-defined macros. */
|
||||
"__DATE__" |
|
||||
"__TIME__" |
|
||||
"__FILE__" |
|
||||
"__LINE__" |
|
||||
"__STDC__" { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* Preprocessor directives */
|
||||
"#"{WhiteSpace}*{PreprocessorWord} { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
/* String/Character Literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); /*addNullToken(); return firstToken;*/ }
|
||||
{ErrorUnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{ErrorCharLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
|
||||
/* Comment Literals. */
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
|
||||
/* Separators. */
|
||||
"(" |
|
||||
")" |
|
||||
"[" |
|
||||
"]" |
|
||||
"{" |
|
||||
"}" { addToken(Token.SEPARATOR); }
|
||||
|
||||
/* Operators. */
|
||||
{Trigraph} |
|
||||
"=" |
|
||||
"+" |
|
||||
"-" |
|
||||
"*" |
|
||||
"/" |
|
||||
"%" |
|
||||
"~" |
|
||||
"<" |
|
||||
">" |
|
||||
"<<" |
|
||||
">>" |
|
||||
"==" |
|
||||
"+=" |
|
||||
"-=" |
|
||||
"*=" |
|
||||
"/=" |
|
||||
"%=" |
|
||||
"&=" |
|
||||
"|=" |
|
||||
"^=" |
|
||||
">=" |
|
||||
"<=" |
|
||||
"!=" |
|
||||
">>=" |
|
||||
"<<=" |
|
||||
"^" |
|
||||
"&" |
|
||||
"&&" |
|
||||
"|" |
|
||||
"||" |
|
||||
"?" |
|
||||
":" |
|
||||
"," |
|
||||
"!" |
|
||||
"++" |
|
||||
"--" |
|
||||
"." |
|
||||
"," { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
/* Some lines will end in '\' to wrap an expression. */
|
||||
"\\" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Other punctuation, we'll highlight it as "identifiers." */
|
||||
";" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\\\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
addToken(start,zzStartRead, Token.COMMENT_EOL);
|
||||
return firstToken;
|
||||
}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,558 +0,0 @@
|
||||
/*
|
||||
* 09/03/2005
|
||||
*
|
||||
* CSSTokenMaker.java - Token maker for CSS 3 files.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class splits up text into tokens representing a CSS 3 file. It's
|
||||
* written with a few extra internal states so that it can easily be copy
|
||||
* and pasted into HTML, PHP, and JSP TokenMakres when it is updated.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>CSSTokenMaker.java</code> file will contain 2
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class CSSTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Internal type denoting a line ending in a CSS property.
|
||||
*/
|
||||
public static final int INTERNAL_CSS_PROPERTY = -1;
|
||||
|
||||
/**
|
||||
* Internal type denoting a line ending in a CSS property value.
|
||||
*/
|
||||
public static final int INTERNAL_CSS_VALUE = -2;
|
||||
|
||||
/**
|
||||
* Internal type denoting line ending in a CSS double-quote string.
|
||||
* The state to return to is embedded in the actual end token type.
|
||||
*/
|
||||
public static final int INTERNAL_CSS_STRING = -(1<<11);
|
||||
|
||||
/**
|
||||
* Internal type denoting line ending in a CSS single-quote string.
|
||||
* The state to return to is embedded in the actual end token type.
|
||||
*/
|
||||
public static final int INTERNAL_CSS_CHAR = -(2<<11);
|
||||
|
||||
/**
|
||||
* Internal type denoting line ending in a CSS multi-line comment.
|
||||
* The state to return to is embedded in the actual end token type.
|
||||
*/
|
||||
public static final int INTERNAL_CSS_MLC = -(3<<11);
|
||||
|
||||
/**
|
||||
* The state previous CSS-related state we were in before going into a CSS
|
||||
* string, multi-line comment, etc.
|
||||
*/
|
||||
private int cssPrevState;
|
||||
|
||||
/**
|
||||
* Whether we are highlighting less instead of CSS.
|
||||
*/
|
||||
private boolean highlightingLess;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public CSSTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the closest {@link TokenTypes "standard" token type} for a given
|
||||
* "internal" token type (e.g. one whose value is <code>< 0</code>).
|
||||
*/
|
||||
@Override
|
||||
public int getClosestStandardTokenTypeForInternalType(int type) {
|
||||
switch (type) {
|
||||
case INTERNAL_CSS_STRING:
|
||||
case INTERNAL_CSS_CHAR:
|
||||
return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
|
||||
case INTERNAL_CSS_MLC:
|
||||
return TokenTypes.COMMENT_MULTILINE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> since CSS uses curly braces.
|
||||
*
|
||||
* @return <code>true</code> always.
|
||||
*/
|
||||
public boolean getCurlyBracesDenoteCodeBlocks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type==Token.RESERVED_WORD; // Used for CSS keys
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getShouldIndentNextLineAfter(Token t) {
|
||||
if (t!=null && t.length()==1) {
|
||||
char ch = t.charAt(0);
|
||||
return ch=='{' || ch=='(';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
cssPrevState = YYINITIAL; // Shouldn't be necessary
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = CSS_STRING;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CSS_CHAR_LITERAL;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = CSS_C_STYLE_COMMENT;
|
||||
break;
|
||||
case INTERNAL_CSS_PROPERTY:
|
||||
state = CSS_PROPERTY;
|
||||
break;
|
||||
case INTERNAL_CSS_VALUE:
|
||||
state = CSS_VALUE;
|
||||
break;
|
||||
default:
|
||||
if (initialTokenType<-1024) {
|
||||
int main = -(-initialTokenType & 0xffffff00);
|
||||
switch (main) {
|
||||
default: // Should never happen
|
||||
case INTERNAL_CSS_STRING:
|
||||
state = CSS_STRING;
|
||||
break;
|
||||
case INTERNAL_CSS_CHAR:
|
||||
state = CSS_CHAR_LITERAL;
|
||||
break;
|
||||
case INTERNAL_CSS_MLC:
|
||||
state = CSS_C_STYLE_COMMENT;
|
||||
break;
|
||||
}
|
||||
cssPrevState = -initialTokenType&0xff;
|
||||
}
|
||||
else {
|
||||
state = YYINITIAL;
|
||||
}
|
||||
}
|
||||
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overridden to accept letters, digits, underscores, and hyphens.
|
||||
*/
|
||||
@Override
|
||||
public boolean isIdentifierChar(int languageIndex, char ch) {
|
||||
return Character.isLetterOrDigit(ch) || ch=='-' || ch=='.' || ch=='_';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggles whether we're highlighting less instead of just CSS.
|
||||
*
|
||||
* @param highlightingLess Whether we're highlighting less.
|
||||
*/
|
||||
public void setHighlightingLess(boolean highlightingLess) {
|
||||
this.highlightingLess = highlightingLess;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Digit = ([0-9])
|
||||
Letter = ([A-Za-z])
|
||||
LetterOrUnderscore = ({Letter}|[_])
|
||||
LetterOrUnderscoreOrDash = ({LetterOrUnderscore}|[\-])
|
||||
|
||||
CSS_SelectorPiece = (("*"|"."|{LetterOrUnderscoreOrDash})({LetterOrUnderscoreOrDash}|"."|{Digit})*)
|
||||
CSS_PseudoClass = (":"("root"|"nth-child"|"nth-last-child"|"nth-of-type"|"nth-last-of-type"|"first-child"|"last-child"|"first-of-type"|"last-of-type"|"only-child"|"only-of-type"|"empty"|"link"|"visited"|"active"|"hover"|"focus"|"target"|"lang"|"enabled"|"disabled"|"checked"|":first-line"|":first-letter"|":before"|":after"|"not"))
|
||||
CSS_AtRule = ("@"(charset|import|namespace|media|document|page|font-face|keyframes|viewport))
|
||||
CSS_Less_Var = ("@"({LetterOrUnderscoreOrDash})({LetterOrUnderscoreOrDash}|"."|{Digit})*)
|
||||
CSS_Id = ("#"{CSS_SelectorPiece})
|
||||
CSS_Separator = ([;\(\)\[\]])
|
||||
WhiteSpace = ([ \t]+)
|
||||
MlcStart = ("/*")
|
||||
MlcEnd = ("*/")
|
||||
|
||||
CSS_Property = ([\*]?{LetterOrUnderscoreOrDash}({LetterOrUnderscoreOrDash}|{Digit})*(:[\w]+)?)
|
||||
CSS_ValueChar = ({LetterOrUnderscoreOrDash}|[\\/])
|
||||
CSS_Value = ({CSS_ValueChar}*)
|
||||
CSS_Function = ({CSS_Value}\()
|
||||
CSS_Digits = ([\-]?{Digit}+([0-9\.]+)?(pt|pc|in|mm|cm|em|ex|px|ms|s|%)?)
|
||||
CSS_Hex = ("#"[0-9a-fA-F]+)
|
||||
CSS_Number = ({CSS_Digits}|{CSS_Hex})
|
||||
|
||||
// Less_Nested_Selector includes pseudo-classes for ease of highlighting, even
|
||||
// though it is not as detailed as standard CSS selector highlighting.
|
||||
Less_Nested_Selector_With_Pseudo = ({CSS_SelectorPiece}{CSS_PseudoClass}*)
|
||||
Less_Selector_ParentRef = ("&"{CSS_SelectorPiece})
|
||||
Less_LineCommentBegin = "//"
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state CSS_PROPERTY
|
||||
%state CSS_VALUE
|
||||
%state CSS_STRING
|
||||
%state CSS_CHAR_LITERAL
|
||||
%state CSS_C_STYLE_COMMENT
|
||||
%state LESS_EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
{CSS_SelectorPiece} { addToken(Token.DATA_TYPE); }
|
||||
{CSS_PseudoClass} { addToken(Token.RESERVED_WORD); }
|
||||
":" { /* Unknown pseudo class */ addToken(Token.DATA_TYPE); }
|
||||
{CSS_AtRule} { addToken(Token.REGEX); }
|
||||
{CSS_Less_Var} { addToken(highlightingLess ? Token.VARIABLE : Token.REGEX); }
|
||||
{CSS_Number} { addToken(highlightingLess ? Token.LITERAL_NUMBER_DECIMAL_INT : Token.IDENTIFIER); }
|
||||
{CSS_Id} { addToken(highlightingLess ? Token.ANNOTATION : Token.VARIABLE); }
|
||||
"{" { addToken(Token.SEPARATOR); yybegin(CSS_PROPERTY); }
|
||||
[,] { addToken(Token.IDENTIFIER); }
|
||||
\" { start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_STRING); }
|
||||
\' { start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_CHAR_LITERAL); }
|
||||
"}" { addToken(highlightingLess ? Token.SEPARATOR : Token.IDENTIFIER); }
|
||||
[+>~\^$\|=] { addToken(Token.OPERATOR); }
|
||||
{CSS_Separator} { addToken(Token.SEPARATOR); }
|
||||
{WhiteSpace} { addToken(Token.WHITESPACE); }
|
||||
{MlcStart} { start = zzMarkedPos-2; cssPrevState = zzLexicalState; yybegin(CSS_C_STYLE_COMMENT); }
|
||||
{Less_LineCommentBegin} {
|
||||
if (highlightingLess) {
|
||||
start = zzMarkedPos-2; yybegin(LESS_EOL_COMMENT);
|
||||
}
|
||||
else { // Highlight the "//" as an identifier and continue on
|
||||
int temp = zzStartRead + 2;
|
||||
addToken(zzStartRead, zzStartRead + 1, Token.IDENTIFIER);
|
||||
zzStartRead = temp;
|
||||
}
|
||||
}
|
||||
. { /*System.out.println("yyinitial: " + yytext());*/ addToken(Token.IDENTIFIER); }
|
||||
"\n" |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<CSS_PROPERTY> {
|
||||
{CSS_Property} { addToken(Token.RESERVED_WORD); }
|
||||
{CSS_Less_Var} { addToken(highlightingLess ? Token.VARIABLE : Token.IDENTIFIER); }
|
||||
{Less_Nested_Selector_With_Pseudo} { addToken(highlightingLess ? Token.RESERVED_WORD : Token.IDENTIFIER); }
|
||||
{Less_Selector_ParentRef} {
|
||||
if (highlightingLess) {
|
||||
// Unfortunately, as we're sharing the CSS and Less
|
||||
// syntax highlighting, we do not color nested selectors
|
||||
// properly. For uniformity, color this the same as
|
||||
// CSS_Property
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
"{" { addToken(Token.SEPARATOR); /* helps with auto-closing curlies when editing CSS */ }
|
||||
"}" { addToken(Token.SEPARATOR); yybegin(YYINITIAL); }
|
||||
":" { addToken(Token.OPERATOR); yybegin(CSS_VALUE); }
|
||||
{WhiteSpace} { addToken(Token.WHITESPACE); }
|
||||
{MlcStart} { start = zzMarkedPos-2; cssPrevState = zzLexicalState; yybegin(CSS_C_STYLE_COMMENT); }
|
||||
{Less_LineCommentBegin} {
|
||||
if (highlightingLess) {
|
||||
cssPrevState = zzLexicalState;
|
||||
start = zzMarkedPos-2; yybegin(LESS_EOL_COMMENT);
|
||||
}
|
||||
else { // Highlight the "//" as an identifier and continue on
|
||||
int temp = zzStartRead + 2;
|
||||
addToken(zzStartRead, zzStartRead + 1, Token.IDENTIFIER);
|
||||
zzStartRead = temp;
|
||||
}
|
||||
}
|
||||
. { /*System.out.println("css_property: " + yytext());*/ addToken(Token.IDENTIFIER); }
|
||||
"\n" |
|
||||
<<EOF>> { addEndToken(INTERNAL_CSS_PROPERTY); return firstToken; }
|
||||
}
|
||||
|
||||
<CSS_VALUE> {
|
||||
{Less_LineCommentBegin} {
|
||||
// This must be before {CSS_Value} since "//" is a valid CSS value
|
||||
if (highlightingLess) {
|
||||
cssPrevState = zzLexicalState;
|
||||
start = zzMarkedPos-2; yybegin(LESS_EOL_COMMENT);
|
||||
}
|
||||
else { // Highlight the "//" as an identifier and continue on
|
||||
int temp = zzStartRead + 2;
|
||||
addToken(zzStartRead, zzStartRead + 1, Token.IDENTIFIER);
|
||||
zzStartRead = temp;
|
||||
}
|
||||
}
|
||||
{CSS_Value} { addToken(Token.IDENTIFIER); }
|
||||
"!important" { addToken(Token.PREPROCESSOR); }
|
||||
{CSS_Function} { int temp = zzMarkedPos - 2;
|
||||
addToken(zzStartRead, temp, Token.FUNCTION);
|
||||
addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos;
|
||||
}
|
||||
{CSS_Number} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{CSS_Less_Var} { addToken(highlightingLess ? Token.VARIABLE : Token.IDENTIFIER); }
|
||||
\" { start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_STRING); }
|
||||
\' { start = zzMarkedPos-1; cssPrevState = zzLexicalState; yybegin(CSS_CHAR_LITERAL); }
|
||||
")" { /* End of a function */ addToken(Token.SEPARATOR); }
|
||||
[;] { addToken(Token.OPERATOR); yybegin(CSS_PROPERTY); }
|
||||
[,\.] { addToken(Token.IDENTIFIER); }
|
||||
"}" { addToken(Token.SEPARATOR); yybegin(YYINITIAL); }
|
||||
{WhiteSpace} { addToken(Token.WHITESPACE); }
|
||||
{MlcStart} { start = zzMarkedPos-2; cssPrevState = zzLexicalState; yybegin(CSS_C_STYLE_COMMENT); }
|
||||
. { /*System.out.println("css_value: " + yytext());*/ addToken(Token.IDENTIFIER); }
|
||||
"\n" |
|
||||
<<EOF>> { addEndToken(INTERNAL_CSS_VALUE); return firstToken; }
|
||||
}
|
||||
|
||||
<CSS_STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\" { addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(cssPrevState); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_CSS_STRING - cssPrevState); return firstToken; }
|
||||
}
|
||||
|
||||
<CSS_CHAR_LITERAL> {
|
||||
[^\n\\\']+ {}
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\' { addToken(start,zzStartRead, Token.LITERAL_CHAR); yybegin(cssPrevState); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); addEndToken(INTERNAL_CSS_CHAR - cssPrevState); return firstToken; }
|
||||
}
|
||||
|
||||
<CSS_C_STYLE_COMMENT> {
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
{MlcEnd} { addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); yybegin(cssPrevState); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_CSS_MLC - cssPrevState); return firstToken; }
|
||||
}
|
||||
|
||||
<LESS_EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> {
|
||||
addToken(start,zzStartRead-1, Token.COMMENT_EOL);
|
||||
switch (cssPrevState) {
|
||||
case CSS_PROPERTY:
|
||||
addEndToken(INTERNAL_CSS_PROPERTY);
|
||||
break;
|
||||
case CSS_VALUE:
|
||||
addEndToken(INTERNAL_CSS_VALUE);
|
||||
break;
|
||||
default: // Should be YYINITIAL
|
||||
addNullToken();
|
||||
break;
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,514 +0,0 @@
|
||||
/*
|
||||
* 11/13/2004
|
||||
*
|
||||
* CSharpTokenMaker.java - An object that can take a chunk of text and return
|
||||
* a linked list of tokens representing it in the C# programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* A lexer for the C# programming language.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>CSharpTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class CSharpTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public CSharpTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = VERBATIMSTRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = DELIMITEDCOMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
/* C1.1 - Line terminators. */
|
||||
NewlineCharacter = ([\n])
|
||||
|
||||
/* C.1.2 - Whitespace. */
|
||||
Whitespace = ([\t ]+)
|
||||
|
||||
/* C.1.3 - Comments */
|
||||
InputCharacter = ([^\n])
|
||||
InputCharacters = ({InputCharacter}+)
|
||||
DocumentationCommentStart = ("///")
|
||||
SingleLineComment = ("//"([^/]{InputCharacters}?)?)
|
||||
DelimitedCommentStart = ("/*")
|
||||
DelimitedCommentEnd = ("*/")
|
||||
|
||||
/* C.1.5 - Unicode character escape sequences. */
|
||||
UnicodeEscape1 = ("\\u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
UnicodeEscape2 = ("\\U"{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
UnicodeEscapeSequence = ({UnicodeEscape1}|{UnicodeEscape2})
|
||||
|
||||
/* C1.6 - Identifiers. */
|
||||
LetterCharacter = ([A-Za-z]) /* Not accurate - many more Unicode letters, Unicode escapes */
|
||||
/*
|
||||
CombiningCharacter = ()
|
||||
*/
|
||||
DecimalDigitCharacter = ([0-9])
|
||||
ConnectingCharacter = ([_\-])
|
||||
/*
|
||||
FormattingCharacter = ()
|
||||
*/
|
||||
/*
|
||||
IdentifierPartCharacter = ({LetterCharacter}|{DecimalDigitCharacter}|{ConnectingCharacter}|{CombiningCharacter}|{FormattingCharacter})
|
||||
*/
|
||||
IdentifierPartCharacter = ({LetterCharacter}|{DecimalDigitCharacter}|{ConnectingCharacter})
|
||||
IdentifierPartCharacters = ({IdentifierPartCharacter}+)
|
||||
IdentifierStartCharacter = ({LetterCharacter}|[_])
|
||||
IdentifierOrKeyword = ({IdentifierStartCharacter}{IdentifierPartCharacters}?)
|
||||
Identifier = ("@"?{IdentifierOrKeyword})
|
||||
/* NOTE: The two below aren't from the C# spec, but we add them so we can */
|
||||
/* highlight errors. */
|
||||
NonSeparator = (([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\"))
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
/* C1.8 - Literals. */
|
||||
BooleanLiteral = ("true"|"false")
|
||||
DecimalDigit = ([0-9])
|
||||
DecimalDigits = ({DecimalDigit}+)
|
||||
IntegerTypeSuffix = (([uU][lL]?)|([lL][uU]?))
|
||||
DecimalIntegerLiteral = ({DecimalDigits}{IntegerTypeSuffix}?)
|
||||
HexDigit = ([0-9A-Fa-f])
|
||||
HexDigits = ({HexDigit}+)
|
||||
HexadecimalIntegerLiteral = ("0"[xX]{HexDigits}{IntegerTypeSuffix}?)
|
||||
Sign = ([+\-])
|
||||
ExponentPart = ([eE]{Sign}?{DecimalDigits})
|
||||
RealTypeSuffix = ([fFdDmM])
|
||||
RealHelper1 = ({DecimalDigits}"."{DecimalDigits}{ExponentPart}?{RealTypeSuffix}?)
|
||||
RealHelper2 = ("."{DecimalDigits}{ExponentPart}?{RealTypeSuffix}?)
|
||||
RealHelper3 = ({DecimalDigits}{ExponentPart}{RealTypeSuffix}?)
|
||||
RealHelper4 = ({DecimalDigits}{RealTypeSuffix})
|
||||
RealLiteral = ({RealHelper1}|{RealHelper2}|{RealHelper3}|{RealHelper4})
|
||||
ErrorNumberFormat = (({DecimalIntegerLiteral}|{HexadecimalIntegerLiteral}|{RealLiteral}){NonSeparator}+)
|
||||
SingleCharacter = ([^\'\\\n])
|
||||
SimpleEscapeSequence = ("\\"[\'\"\\0abfnrtv])
|
||||
HexadecimalEscapeSequence = ("\\x"{HexDigit}{HexDigit}?{HexDigit}?{HexDigit}?)
|
||||
Character = ({SingleCharacter}|{SimpleEscapeSequence}|{HexadecimalEscapeSequence}|{UnicodeEscapeSequence})
|
||||
UnclosedCharacterLiteral = ("'"{Character})
|
||||
CharacterLiteral = ({UnclosedCharacterLiteral}"'")
|
||||
ErrorUnclosedCharacterLiteral = ("'"[^\'\n]*)
|
||||
ErrorCharacterLiteral = ("''"|{ErrorUnclosedCharacterLiteral}[\'])
|
||||
QuoteEscapeSequence = ("\"\"")
|
||||
SingleVerbatimStringLiteralCharacter = ([^\"])
|
||||
VerbatimStringLiteralStart = ("@\"")
|
||||
SingleRegularStringLiteralCharacter = ([^\"\\\n])
|
||||
RegularStringLiteralCharacter = ({SingleRegularStringLiteralCharacter}|{SimpleEscapeSequence}|{HexadecimalEscapeSequence}|{UnicodeEscapeSequence})
|
||||
RegularStringLiteralCharacters = ({RegularStringLiteralCharacter}+)
|
||||
RegularStringLiteral = ([\"]{RegularStringLiteralCharacters}?[\"])
|
||||
UnclosedRegularStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
ErrorRegularStringLiteral = ({UnclosedRegularStringLiteral}[\"])
|
||||
|
||||
/* C.1.9 - Operators and Punctuators. */
|
||||
OOPHelper1 = (":")
|
||||
OOPHelper2 = ("+"|"-"|"*"|"/"|"%"|"&"|"|"|"^"|"!"|"~")
|
||||
OOPHelper3 = ("="|"<"|">"|"?"|"++"|"--"|"&&"|"||"|"<<"|">>")
|
||||
OOPHelper4 = ("=="|"!="|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&=")
|
||||
OOPHelper5 = ("|="|"^="|"<<="|">>="|"->")
|
||||
OperatorOrPunctuator = ({OOPHelper1}|{OOPHelper2}|{OOPHelper3}|{OOPHelper4}|{OOPHelper5})
|
||||
/* NOTE: We distinguish between operators and separators (punctuators), but */
|
||||
/* the C# spec doesn't, so the stuff below isn't in the spec. */
|
||||
Separator = ([\{\}\[\]\(\)])
|
||||
Separator2 = ([,;])
|
||||
|
||||
/* C.1.10 - Pre-processing Directives. */
|
||||
/* NOTE: We don't do ALL of the PP stuff here as it's unnecessary */
|
||||
/* for us to know the difference between declarations, diagnostics, */
|
||||
/* regions, etc. */
|
||||
ConditionalSymbol = ({IdentifierOrKeyword}) /* Not correct - excludes "true" and "false". */
|
||||
PPNewLine = ({Whitespace}?{SingleLineComment}?{NewlineCharacter})
|
||||
PPPrimaryExpression = ({IdentifierOrKeyword}|({Whitespace}?{PPExpression}{Whitespace}?))
|
||||
PPUnaryExpression = ({PPPrimaryExpression}|("!"{Whitespace}?{PPUnaryExpression}))
|
||||
PPEqualityExpression = ({PPUnaryExpression}|({Whitespace}?"=="{Whitespace}?{PPUnaryExpression})|({Whitespace}?"!="{Whitespace}?{PPUnaryExpression}))
|
||||
PPAndExpression = ({PPEqualityExpression}|({Whitespace}?"&&"{Whitespace}?{PPEqualityExpression}))
|
||||
PPOrExpression = ({PPAndExpression}|({Whitespace}?"||"{Whitespace}?{PPAndExpression}))
|
||||
PPExpression = ({Whitespace}?{PPOrExpression}{Whitespace}?)
|
||||
PPWord = ("define"|"undef"|"if"|"elif"|"else"|"endif"|"line"|"error"|"warning"|"region"|"endregion")
|
||||
PPDirective = ({Whitespace}?"#"{Whitespace}?{PPWord}{InputCharacter}*)
|
||||
|
||||
/* URL matching, for comments (not in C# spec) */
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ([A-Za-z_]|{DecimalDigitCharacter}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|[A-Za-z0-9])
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state DELIMITEDCOMMENT
|
||||
%state DOCUMENTCOMMENT
|
||||
%state VERBATIMSTRING
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"abstract" |
|
||||
"as" |
|
||||
"base" |
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"checked" |
|
||||
"class" |
|
||||
"const" |
|
||||
"continue" |
|
||||
"decimal" |
|
||||
"default" |
|
||||
"delegate" |
|
||||
"do" |
|
||||
"else" |
|
||||
"enum" |
|
||||
"event" |
|
||||
"explicit" |
|
||||
"extern" |
|
||||
"finally" |
|
||||
"fixed" |
|
||||
"for" |
|
||||
"foreach" |
|
||||
"goto" |
|
||||
"if" |
|
||||
"implicit" |
|
||||
"in" |
|
||||
"interface" |
|
||||
"internal" |
|
||||
"is" |
|
||||
"lock" |
|
||||
"namespace" |
|
||||
"new" |
|
||||
"null" |
|
||||
"object" |
|
||||
"operator" |
|
||||
"out" |
|
||||
"override" |
|
||||
"params" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"readonly" |
|
||||
"ref" |
|
||||
"return" |
|
||||
"sealed" |
|
||||
"sizeof" |
|
||||
"stackalloc" |
|
||||
"static" |
|
||||
"string" |
|
||||
"struct" |
|
||||
"switch" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try" |
|
||||
"typeof" |
|
||||
"unchecked" |
|
||||
"unsafe" |
|
||||
"using" |
|
||||
"virtual" |
|
||||
"void" |
|
||||
"volatile" |
|
||||
"while" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Data types. */
|
||||
"bool" |
|
||||
"byte" |
|
||||
"char" |
|
||||
"double" |
|
||||
"float" |
|
||||
"int" |
|
||||
"long" |
|
||||
"object" |
|
||||
"sbyte" |
|
||||
"short" |
|
||||
"string" |
|
||||
"uint" |
|
||||
"ulong" |
|
||||
"ushort" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
|
||||
{NewlineCharacter} { addNullToken(); return firstToken; }
|
||||
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character Literals. */
|
||||
{CharacterLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharacterLiteral} { addToken(Token.ERROR_CHAR); /*addNullToken(); return firstToken;*/ }
|
||||
{ErrorUnclosedCharacterLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{ErrorCharacterLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
{VerbatimStringLiteralStart} { start = zzMarkedPos-2; yybegin(VERBATIMSTRING); }
|
||||
{RegularStringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedRegularStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorRegularStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
|
||||
/* Comments. */
|
||||
{DelimitedCommentStart} { start = zzMarkedPos-2; yybegin(DELIMITEDCOMMENT); }
|
||||
{DocumentationCommentStart} { start = zzMarkedPos-3; yybegin(DOCUMENTCOMMENT); }
|
||||
{SingleLineComment} { addToken(Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{OperatorOrPunctuator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{DecimalIntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexadecimalIntegerLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{RealLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
/* Preprocessor directives. */
|
||||
{PPDirective} { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
/* Pretty-much anything else. */
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<DELIMITEDCOMMENT> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{DelimitedCommentEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<DOCUMENTCOMMENT> {
|
||||
|
||||
[^hwf\<\n]* {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_DOCUMENTATION); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addNullToken(); return firstToken; }
|
||||
"<"[^\>]*">" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.PREPROCESSOR); start = zzMarkedPos; }
|
||||
"<" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzEndRead, Token.PREPROCESSOR); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<VERBATIMSTRING> {
|
||||
|
||||
[^\"\n]* {}
|
||||
{QuoteEscapeSequence} {}
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,647 +0,0 @@
|
||||
/*
|
||||
* 11/13/2004
|
||||
*
|
||||
* CTokenMaker.java - An object that can take a chunk of text and
|
||||
* return a linked list of tokens representing it in the C programming
|
||||
* language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the C programming language.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>CTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.6
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class CTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public CTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|[_])
|
||||
Digit = [0-9]
|
||||
HexDigit = {Digit}|[A-Fa-f]
|
||||
OctalDigit = [0-7]
|
||||
Exponent = [eE][+-]?{Digit}+
|
||||
|
||||
PreprocessorWord = define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef
|
||||
|
||||
Trigraph = ("??="|"??("|"??)"|"??/"|"??'"|"??<"|"??>"|"??!"|"??-")
|
||||
|
||||
OctEscape1 = ([\\]{OctalDigit})
|
||||
OctEscape2 = ([\\]{OctalDigit}{OctalDigit})
|
||||
OctEscape3 = ([\\][0-3]{OctalDigit}{OctalDigit})
|
||||
OctEscape = ({OctEscape1}|{OctEscape2}|{OctEscape3})
|
||||
HexEscape = ([\\][xX]{HexDigit}{HexDigit})
|
||||
|
||||
AnyChrChr = ([^\'\n\\])
|
||||
Escape = ([\\]([abfnrtv\'\"\?\\0e]))
|
||||
UnclosedCharLiteral = ([\']({Escape}|{OctEscape}|{HexEscape}|{Trigraph}|{AnyChrChr}))
|
||||
CharLiteral = ({UnclosedCharLiteral}[\'])
|
||||
ErrorUnclosedCharLiteral = ([\'][^\'\n]*)
|
||||
ErrorCharLiteral = (([\'][\'])|{ErrorUnclosedCharLiteral}[\'])
|
||||
AnyStrChr = ([^\"\n\\])
|
||||
FalseTrigraph = (("?"(("?")*)[^\=\(\)\/\'\<\>\!\-\\\?\"\n])|("?"[\=\(\)\/\'\<\>\!\-]))
|
||||
StringLiteral = ([\"]((((("?")*)({Escape}|{OctEscape}|{HexEscape}|{Trigraph}))|{FalseTrigraph}|{AnyStrChr})*)(("?")*)[\"])
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
|
||||
LineTerminator = \n
|
||||
WhiteSpace = [ \t\f]
|
||||
|
||||
MLCBegin = "/*"
|
||||
MLCEnd = "*/"
|
||||
LineCommentBegin = "//"
|
||||
|
||||
NonFloatSuffix = (([uU][lL]?)|([lL][uU]?))
|
||||
IntegerLiteral = ({Digit}+{Exponent}?{NonFloatSuffix}?)
|
||||
HexLiteral = ("0"[xX]{HexDigit}+{NonFloatSuffix}?)
|
||||
FloatLiteral = ((({Digit}*[\.]{Digit}+)|({Digit}+[\.]{Digit}*)){Exponent}?[fFlL]?)
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#")
|
||||
Identifier = ({LetterOrUnderscore}({LetterOrUnderscore}|{Digit}|[$])*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state MLC
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"auto" |
|
||||
"break" |
|
||||
"case" |
|
||||
"const" |
|
||||
"continue" |
|
||||
"default" |
|
||||
"do" |
|
||||
"else" |
|
||||
"enum" |
|
||||
"extern" |
|
||||
"for" |
|
||||
"goto" |
|
||||
"if" |
|
||||
"register" |
|
||||
"sizeof" |
|
||||
"static" |
|
||||
"struct" |
|
||||
"switch" |
|
||||
"typedef" |
|
||||
"union" |
|
||||
"volatile" |
|
||||
"while" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
/* Data types. */
|
||||
"char" |
|
||||
"div_t" |
|
||||
"double" |
|
||||
"float" |
|
||||
"int" |
|
||||
"ldiv_t" |
|
||||
"long" |
|
||||
"short" |
|
||||
"signed" |
|
||||
"size_t" |
|
||||
"unsigned" |
|
||||
"void" |
|
||||
"wchar_t" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Standard functions */
|
||||
"abort" |
|
||||
"abs" |
|
||||
"acos" |
|
||||
"asctime" |
|
||||
"asin" |
|
||||
"assert" |
|
||||
"atan2" |
|
||||
"atan" |
|
||||
"atexit" |
|
||||
"atof" |
|
||||
"atoi" |
|
||||
"atol" |
|
||||
"bsearch" |
|
||||
"btowc" |
|
||||
"calloc" |
|
||||
"ceil" |
|
||||
"clearerr" |
|
||||
"clock" |
|
||||
"cosh" |
|
||||
"cos" |
|
||||
"ctime" |
|
||||
"difftime" |
|
||||
"div" |
|
||||
"errno" |
|
||||
"exit" |
|
||||
"exp" |
|
||||
"fabs" |
|
||||
"fclose" |
|
||||
"feof" |
|
||||
"ferror" |
|
||||
"fflush" |
|
||||
"fgetc" |
|
||||
"fgetpos" |
|
||||
"fgetwc" |
|
||||
"fgets" |
|
||||
"fgetws" |
|
||||
"floor" |
|
||||
"fmod" |
|
||||
"fopen" |
|
||||
"fprintf" |
|
||||
"fputc" |
|
||||
"fputs" |
|
||||
"fputwc" |
|
||||
"fputws" |
|
||||
"fread" |
|
||||
"free" |
|
||||
"freopen" |
|
||||
"frexp" |
|
||||
"fscanf" |
|
||||
"fseek" |
|
||||
"fsetpos" |
|
||||
"ftell" |
|
||||
"fwprintf" |
|
||||
"fwrite" |
|
||||
"fwscanf" |
|
||||
"getchar" |
|
||||
"getc" |
|
||||
"getenv" |
|
||||
"gets" |
|
||||
"getwc" |
|
||||
"getwchar" |
|
||||
"gmtime" |
|
||||
"isalnum" |
|
||||
"isalpha" |
|
||||
"iscntrl" |
|
||||
"isdigit" |
|
||||
"isgraph" |
|
||||
"islower" |
|
||||
"isprint" |
|
||||
"ispunct" |
|
||||
"isspace" |
|
||||
"isupper" |
|
||||
"isxdigit" |
|
||||
"labs" |
|
||||
"ldexp" |
|
||||
"ldiv" |
|
||||
"localeconv" |
|
||||
"localtime" |
|
||||
"log10" |
|
||||
"log" |
|
||||
"longjmp" |
|
||||
"malloc" |
|
||||
"mblen" |
|
||||
"mbrlen" |
|
||||
"mbrtowc" |
|
||||
"mbsinit" |
|
||||
"mbsrtowcs" |
|
||||
"mbstowcs" |
|
||||
"mbtowc" |
|
||||
"memchr" |
|
||||
"memcmp" |
|
||||
"memcpy" |
|
||||
"memmove" |
|
||||
"memset" |
|
||||
"mktime" |
|
||||
"modf" |
|
||||
"offsetof" |
|
||||
"perror" |
|
||||
"pow" |
|
||||
"printf" |
|
||||
"putchar" |
|
||||
"putc" |
|
||||
"puts" |
|
||||
"putwc" |
|
||||
"putwchar" |
|
||||
"qsort" |
|
||||
"raise" |
|
||||
"rand" |
|
||||
"realloc" |
|
||||
"remove" |
|
||||
"rename" |
|
||||
"rewind" |
|
||||
"scanf" |
|
||||
"setbuf" |
|
||||
"setjmp" |
|
||||
"setlocale" |
|
||||
"setvbuf" |
|
||||
"setvbuf" |
|
||||
"signal" |
|
||||
"sinh" |
|
||||
"sin" |
|
||||
"sprintf" |
|
||||
"sqrt" |
|
||||
"srand" |
|
||||
"sscanf" |
|
||||
"strcat" |
|
||||
"strchr" |
|
||||
"strcmp" |
|
||||
"strcmp" |
|
||||
"strcoll" |
|
||||
"strcpy" |
|
||||
"strcspn" |
|
||||
"strerror" |
|
||||
"strftime" |
|
||||
"strlen" |
|
||||
"strncat" |
|
||||
"strncmp" |
|
||||
"strncpy" |
|
||||
"strpbrk" |
|
||||
"strrchr" |
|
||||
"strspn" |
|
||||
"strstr" |
|
||||
"strtod" |
|
||||
"strtok" |
|
||||
"strtol" |
|
||||
"strtoul" |
|
||||
"strxfrm" |
|
||||
"swprintf" |
|
||||
"swscanf" |
|
||||
"system" |
|
||||
"tanh" |
|
||||
"tan" |
|
||||
"time" |
|
||||
"tmpfile" |
|
||||
"tmpnam" |
|
||||
"tolower" |
|
||||
"toupper" |
|
||||
"ungetc" |
|
||||
"ungetwc" |
|
||||
"va_arg" |
|
||||
"va_end" |
|
||||
"va_start" |
|
||||
"vfprintf" |
|
||||
"vfwprintf" |
|
||||
"vprintf" |
|
||||
"vsprintf" |
|
||||
"vswprintf" |
|
||||
"vwprintf" |
|
||||
"wcrtomb" |
|
||||
"wcscat" |
|
||||
"wcschr" |
|
||||
"wcscmp" |
|
||||
"wcscoll" |
|
||||
"wcscpy" |
|
||||
"wcscspn" |
|
||||
"wcsftime" |
|
||||
"wcslen" |
|
||||
"wcsncat" |
|
||||
"wcsncmp" |
|
||||
"wcsncpy" |
|
||||
"wcspbrk" |
|
||||
"wcsrchr" |
|
||||
"wcsrtombs" |
|
||||
"wcsspn" |
|
||||
"wcsstr" |
|
||||
"wcstod" |
|
||||
"wcstok" |
|
||||
"wcstol" |
|
||||
"wcstombs" |
|
||||
"wcstoul" |
|
||||
"wcsxfrm" |
|
||||
"wctob" |
|
||||
"wctomb" |
|
||||
"wmemchr" |
|
||||
"wmemcmp" |
|
||||
"wmemcpy" |
|
||||
"wmemmove" |
|
||||
"wmemset" |
|
||||
"wprintf" |
|
||||
"wscanf" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Standard-defined macros. */
|
||||
"__DATE__" |
|
||||
"__TIME__" |
|
||||
"__FILE__" |
|
||||
"__LINE__" |
|
||||
"__STDC__" { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* Preprocessor directives */
|
||||
"#"{WhiteSpace}*{PreprocessorWord} { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
/* String/Character Literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); /*addNullToken(); return firstToken;*/ }
|
||||
{ErrorUnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{ErrorCharLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
|
||||
/* Comment Literals. */
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
|
||||
/* Separators. */
|
||||
"(" |
|
||||
")" |
|
||||
"[" |
|
||||
"]" |
|
||||
"{" |
|
||||
"}" { addToken(Token.SEPARATOR); }
|
||||
|
||||
/* Operators. */
|
||||
{Trigraph} |
|
||||
"=" |
|
||||
"+" |
|
||||
"-" |
|
||||
"*" |
|
||||
"/" |
|
||||
"%" |
|
||||
"~" |
|
||||
"<" |
|
||||
">" |
|
||||
"<<" |
|
||||
">>" |
|
||||
"==" |
|
||||
"+=" |
|
||||
"-=" |
|
||||
"*=" |
|
||||
"/=" |
|
||||
"%=" |
|
||||
"&=" |
|
||||
"|=" |
|
||||
"^=" |
|
||||
">=" |
|
||||
"<=" |
|
||||
"!=" |
|
||||
">>=" |
|
||||
"<<=" |
|
||||
"^" |
|
||||
"&" |
|
||||
"&&" |
|
||||
"|" |
|
||||
"||" |
|
||||
"?" |
|
||||
":" |
|
||||
"," |
|
||||
"!" |
|
||||
"++" |
|
||||
"--" |
|
||||
"." |
|
||||
"," { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
/* Some lines will end in '\' to wrap an expression. */
|
||||
"\\" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Other punctuation, we'll highlight it as "identifiers." */
|
||||
";" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,561 +0,0 @@
|
||||
/*
|
||||
* 12/23/2010
|
||||
*
|
||||
* ClojureTokenMaker.java - Scanner for Clojure.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Clojure programming language.<p>
|
||||
*
|
||||
* The original version of this class was graciously donated by the folks at the
|
||||
* <a href="http://pacific.mpi-cbg.de/wiki/index.php/Fiji">Fiji</a> project.
|
||||
* This version has been modified to fix a few issues.
|
||||
* Its original location was
|
||||
* <a href="http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=tree;f=src-plugins/Script_Editor/fiji/scripting;hb=935d85d9d88dd780c6d5f2765937ddc18b5008ca">here</a>.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>ClojureTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class ClojureTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public ClojureTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { ";", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
/*case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_DOCUMENTATION:
|
||||
state = DOCCOMMENT;
|
||||
start = text.offset;
|
||||
break;*/
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
|
||||
LineCommentBegin = (";")
|
||||
Keyword = ([:][a-zA-Z?!\-+*/][a-zA-Z0-9?!\-+*/]*)
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
|
||||
AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
|
||||
StringLiteralStart = ([\"])
|
||||
CharLiteral = ("\\."|"\\space"|"\\tab"|"\\newline")
|
||||
AnyCharacter = ([.]*)
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'])
|
||||
|
||||
BooleanLiteral =("true"|"false")
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
|
||||
|
||||
Nil = ("nil")
|
||||
Quote = (\('\|`\))
|
||||
Unquote = (\(\~@\|\~\))
|
||||
DispatchStart = ("#^"|"#^{")
|
||||
Dispatch = ({DispatchStart}[^\s\t\n;\"}]*([ \t\n;\"]|"}"))
|
||||
VarQuote = ("#'"[.]*[ \t\n;(\"])
|
||||
DefName = ([a-zA-Z0-9?!\-+*\./<>_]*)
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"<"|"*"|">="|"%"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|">>>")
|
||||
AssignmentOperator = ("=")
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator})
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|[_])
|
||||
Digit = [0-9]
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state STRING
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
"case" |
|
||||
"class" |
|
||||
"cond" |
|
||||
"condp" |
|
||||
"def" |
|
||||
"defmacro" |
|
||||
"defn" |
|
||||
"do" |
|
||||
"fn" |
|
||||
"for" |
|
||||
"if" |
|
||||
"if-let" |
|
||||
"if-not" |
|
||||
"instance?" |
|
||||
"let" |
|
||||
"loop" |
|
||||
"monitor-enter" |
|
||||
"monitor-exit" |
|
||||
"new" |
|
||||
"quote" |
|
||||
"recur" |
|
||||
"set!" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try-finally" |
|
||||
"var" |
|
||||
"when" |
|
||||
"when-first" |
|
||||
"when-let" |
|
||||
"when-not" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
"*warn-on-reflection*" |
|
||||
"*1" |
|
||||
"*2" |
|
||||
"*3" |
|
||||
"*agent*" |
|
||||
"*allow-unresolved-args*" |
|
||||
"*assert*" |
|
||||
"*clojure-version*" |
|
||||
"*command-line-args*" |
|
||||
"*compile-files*" |
|
||||
"*compile-path*" |
|
||||
"*e" |
|
||||
"*err*" |
|
||||
"*file*" |
|
||||
"*flush-on-newline*" |
|
||||
"*fn-loader*" |
|
||||
"*in*" |
|
||||
"*math-context*" |
|
||||
"*ns*" |
|
||||
"*out*" |
|
||||
"*print-dup*" |
|
||||
"*print-length*" |
|
||||
"*print-level*" |
|
||||
"*print-meta*" |
|
||||
"*print-readably*" |
|
||||
"*read-eval*" |
|
||||
"*source-path*" |
|
||||
"*unchecked-math*" |
|
||||
"*use-context-classloader*" { addToken(Token.VARIABLE); }
|
||||
|
||||
"*current-namespace*" |
|
||||
"*in*" |
|
||||
"*out*" |
|
||||
"*print-meta*" |
|
||||
"->" |
|
||||
".." |
|
||||
"agent" |
|
||||
"agent-errors" |
|
||||
"agent-of" |
|
||||
"aget" |
|
||||
"alter" |
|
||||
"and" |
|
||||
"any" |
|
||||
"appl" |
|
||||
"apply" |
|
||||
"array" |
|
||||
"aset" |
|
||||
"aset-boolean" |
|
||||
"aset-byte" |
|
||||
"aset-double" |
|
||||
"aset-float" |
|
||||
"aset-int" |
|
||||
"aset-long" |
|
||||
"aset-short" |
|
||||
"assoc" |
|
||||
"binding" |
|
||||
"boolean" |
|
||||
"byte" |
|
||||
"char" |
|
||||
"clear-agent-errors" |
|
||||
"commute" |
|
||||
"comp" |
|
||||
"complement" |
|
||||
"concat" |
|
||||
"conj" |
|
||||
"cons" |
|
||||
"constantly" |
|
||||
"count" |
|
||||
"cycle" |
|
||||
"dec" |
|
||||
"defmethod" |
|
||||
"defmulti" |
|
||||
"delay" |
|
||||
"deref" |
|
||||
"dissoc" |
|
||||
"doseq" |
|
||||
"dotimes" |
|
||||
"doto" |
|
||||
"double" |
|
||||
"drop" |
|
||||
"drop-while" |
|
||||
"ensure" |
|
||||
"eql-ref?" |
|
||||
"eql?" |
|
||||
"eval" |
|
||||
"every" |
|
||||
"ffirst" |
|
||||
"filter" |
|
||||
"find" |
|
||||
"find-var" |
|
||||
"first" |
|
||||
"float" |
|
||||
"fnseq" |
|
||||
"frest" |
|
||||
"gensym" |
|
||||
"get" |
|
||||
"hash-map" |
|
||||
"identity" |
|
||||
"implement" |
|
||||
"import" |
|
||||
"in-namespace" |
|
||||
"inc" |
|
||||
"int" |
|
||||
"into" |
|
||||
"into-array" |
|
||||
"iterate" |
|
||||
"key" |
|
||||
"keys" |
|
||||
"lazy-cons" |
|
||||
"list" |
|
||||
"list*" |
|
||||
"load-file" |
|
||||
"locking" |
|
||||
"long" |
|
||||
"make-array" |
|
||||
"make-proxy" |
|
||||
"map" |
|
||||
"mapcat" |
|
||||
"max" |
|
||||
"memfn" |
|
||||
"merge" |
|
||||
"meta" |
|
||||
"min" |
|
||||
"name" |
|
||||
"namespace" |
|
||||
"neg?" |
|
||||
"newline" |
|
||||
"nil?" |
|
||||
"not" |
|
||||
"not-any" |
|
||||
"not-every" |
|
||||
"nth" |
|
||||
"or" |
|
||||
"peek" |
|
||||
"pmap" |
|
||||
"pop" |
|
||||
"pos?" |
|
||||
"print" |
|
||||
"prn" |
|
||||
"quot" |
|
||||
"range" |
|
||||
"read" |
|
||||
"reduce" |
|
||||
"ref" |
|
||||
"refer" |
|
||||
"rem" |
|
||||
"remove-method" |
|
||||
"repeat" |
|
||||
"replicate" |
|
||||
"rest" |
|
||||
"reverse" |
|
||||
"rfirst" |
|
||||
"rrest" |
|
||||
"rseq" |
|
||||
"second" |
|
||||
"seq" |
|
||||
"set" |
|
||||
"short" |
|
||||
"sorted-map" |
|
||||
"sorted-map-by" |
|
||||
"split-at" |
|
||||
"split-with" |
|
||||
"str" |
|
||||
"strcat" |
|
||||
"sym" |
|
||||
"sync" |
|
||||
"take" |
|
||||
"take-while" |
|
||||
"time" |
|
||||
"unimport" |
|
||||
"unintern" |
|
||||
"unrefer" |
|
||||
"val" |
|
||||
"vals" |
|
||||
"vector" |
|
||||
"with-meta" |
|
||||
"zero?" |
|
||||
"zipmap" { addToken(Token.FUNCTION); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{StringLiteralStart} { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
|
||||
{Nil} { addToken(Token.DATA_TYPE); }
|
||||
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
|
||||
{Quote} { addToken(Token.SEPARATOR); }
|
||||
{Unquote} { addToken(Token.SEPARATOR); }
|
||||
{VarQuote} { addToken(Token.SEPARATOR); }
|
||||
{Dispatch} { addToken(Token.DATA_TYPE); }
|
||||
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
{Keyword} { addToken(Token.PREPROCESSOR); }
|
||||
{DefName} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\"\" {}
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,663 +0,0 @@
|
||||
/*
|
||||
* 09/08/2014
|
||||
*
|
||||
* DTokenMaker.java - Scanner for the D programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the D programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>DTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class DTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Token type specific to DTokenMaker; this signals that the user is in
|
||||
* a nestable multi-line comment. The nested depth is embedded in the
|
||||
* actual end token type.
|
||||
*/
|
||||
private static final int INTERNAL_IN_NESTABLE_MLC = -(1<<11);
|
||||
|
||||
/**
|
||||
* When in a (possibly) nested MLC, this is the current nested depth.
|
||||
*/
|
||||
private int nestedMlcDepth;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public DTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
private void addNestedMlcEndToken() {
|
||||
addEndToken(INTERNAL_IN_NESTABLE_MLC - nestedMlcDepth);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getClosestStandardTokenTypeForInternalType(int type) {
|
||||
switch (type) {
|
||||
case INTERNAL_IN_NESTABLE_MLC:
|
||||
return TokenTypes.COMMENT_MULTILINE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
nestedMlcDepth = 0;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_BACKQUOTE:
|
||||
state = WYSIWYG_STRING_2;
|
||||
break;
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = WYSIWYG_STRING_1;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
break;
|
||||
case Token.COMMENT_DOCUMENTATION:
|
||||
state = DOCCOMMENT;
|
||||
break;
|
||||
case INTERNAL_IN_NESTABLE_MLC:
|
||||
state = NESTABLE_MLC;
|
||||
break;
|
||||
default:
|
||||
if (initialTokenType<-1024) {
|
||||
int main = -(-initialTokenType & 0xffffff00);
|
||||
switch (main) {
|
||||
default: // Should never happen
|
||||
case INTERNAL_IN_NESTABLE_MLC:
|
||||
state = NESTABLE_MLC;
|
||||
break;
|
||||
}
|
||||
nestedMlcDepth = -initialTokenType&0xff;
|
||||
}
|
||||
else {
|
||||
state = YYINITIAL;
|
||||
}
|
||||
}
|
||||
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
* @exception IOException if any I/O-Error occurs.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = ([A-Za-z])
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = ([1-9])
|
||||
BinaryDigit = ([0-1])
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
AnyCharacterButApostropheOrBackSlash = ([^\\'])
|
||||
AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'\`]|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
StringPostfix = ([cwd])
|
||||
CharLiteral = ([\']({AnyCharacterButApostropheOrBackSlash}|{Escape})[\']{StringPostfix}?)
|
||||
UnclosedCharLiteral = ([\'][^\'\n]*)
|
||||
ErrorCharLiteral = ({UnclosedCharLiteral}[\']{StringPostfix}?)
|
||||
StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"]{StringPostfix}?)
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
HexStringLiteral = ([x]{StringLiteral})
|
||||
UnclosedHexStringLiteral = ([x]{UnclosedStringLiteral})
|
||||
ErrorStringLiteral = ({UnclosedStringLiteral}[\"]{StringPostfix}?)
|
||||
WysiwygStringLiteralStart = ("r"[\"])
|
||||
WysiwygStringLiteralStart2 = ("`")
|
||||
|
||||
MLCBegin = "/*"
|
||||
MLCEnd = "*/"
|
||||
DocCommentBegin = "/**"
|
||||
NestableMLCBegin = "/+"
|
||||
LineCommentBegin = "//"
|
||||
LineDocCommentBegin = "///"
|
||||
|
||||
DigitOrUnderscore = ({Digit}|[_])
|
||||
DigitsAndUnderscoresEnd = ({DigitOrUnderscore}*{Digit})
|
||||
IntegerHelper = (({NonzeroDigit}{DigitsAndUnderscoresEnd}?)|"0")
|
||||
IntegerLiteral = ({IntegerHelper}[lL]?)
|
||||
|
||||
BinaryDigitOrUnderscore = ({BinaryDigit}|[_])
|
||||
BinaryDigitsAndUnderscores = ({BinaryDigit}({BinaryDigitOrUnderscore}*{BinaryDigit})?)
|
||||
BinaryLiteral = ("0"[bB]{BinaryDigitsAndUnderscores})
|
||||
|
||||
HexDigitOrUnderscore = ({HexDigit}|[_])
|
||||
HexDigitsAndUnderscores = ({HexDigit}({HexDigitOrUnderscore}*{HexDigit})?)
|
||||
OctalDigitOrUnderscore = ({OctalDigit}|[_])
|
||||
OctalDigitsAndUnderscoresEnd= ({OctalDigitOrUnderscore}*{OctalDigit})
|
||||
HexHelper = ("0"(([xX]{HexDigitsAndUnderscores})|({OctalDigitsAndUnderscoresEnd})))
|
||||
NonFloatSuffix = (([uU][lL]?)|([lL][uU]?))
|
||||
HexLiteral = ({HexHelper}{NonFloatSuffix}?)
|
||||
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator})
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
Annotation = ("@"{Identifier}?)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state MLC
|
||||
%state DOCCOMMENT
|
||||
%state NESTABLE_MLC
|
||||
%state EOL_COMMENT
|
||||
%state EOL_DOCCOMMENT
|
||||
%state WYSIWYG_STRING_1
|
||||
%state WYSIWYG_STRING_2
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"abstract" |
|
||||
"alias" |
|
||||
"align" |
|
||||
"asm" |
|
||||
"assert" |
|
||||
"auto" |
|
||||
|
||||
"body" |
|
||||
"break" |
|
||||
|
||||
"case" |
|
||||
"cast" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"const" |
|
||||
"continue" |
|
||||
|
||||
"debug" |
|
||||
"default" |
|
||||
"delegate" |
|
||||
"delete" |
|
||||
"deprecated" |
|
||||
"do" |
|
||||
|
||||
"else" |
|
||||
"enum" |
|
||||
"export" |
|
||||
"extern" |
|
||||
|
||||
"final" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"foreach" |
|
||||
"foreach_reverse" |
|
||||
"function" |
|
||||
|
||||
"goto" |
|
||||
|
||||
"if" |
|
||||
"immutable" |
|
||||
"import" |
|
||||
"in" |
|
||||
"inout" |
|
||||
"interface" |
|
||||
"invariant" |
|
||||
"is" |
|
||||
|
||||
"lazy" |
|
||||
|
||||
"macro" |
|
||||
"mixin" |
|
||||
"module" |
|
||||
|
||||
"new" |
|
||||
"nothrow" |
|
||||
"null" |
|
||||
|
||||
"out" |
|
||||
"override" |
|
||||
|
||||
"package" |
|
||||
"pragma" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"pure" |
|
||||
|
||||
"ref" |
|
||||
|
||||
"scope" |
|
||||
"shared" |
|
||||
"static" |
|
||||
"struct" |
|
||||
"super" |
|
||||
"switch" |
|
||||
"synchronized" |
|
||||
|
||||
"template" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try" |
|
||||
"typedef" |
|
||||
"typeid" |
|
||||
"typeof" |
|
||||
|
||||
"union" |
|
||||
"unittest" |
|
||||
|
||||
"version" |
|
||||
"void" |
|
||||
"volatile" |
|
||||
|
||||
"while" |
|
||||
"with" |
|
||||
|
||||
"__FILE__" |
|
||||
"__MODULE__" |
|
||||
"__LINE__" |
|
||||
"__FUNCTION__" |
|
||||
"__PRETTY_FUNCTION__" |
|
||||
|
||||
"__gshared" |
|
||||
"__traits" |
|
||||
"__vector" |
|
||||
"__parameters" { addToken(Token.RESERVED_WORD); }
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
/* Data types. */
|
||||
"string" |
|
||||
"wstring" |
|
||||
"dstring" |
|
||||
"size_t" |
|
||||
"ptrdiff_t" |
|
||||
"bool" |
|
||||
"byte" |
|
||||
"cdouble" |
|
||||
"cent" |
|
||||
"cfloat" |
|
||||
"char" |
|
||||
"creal" |
|
||||
"dchar" |
|
||||
"double" |
|
||||
"float" |
|
||||
"idouble" |
|
||||
"ifloat" |
|
||||
"ireal" |
|
||||
"int" |
|
||||
"long" |
|
||||
"real" |
|
||||
"short" |
|
||||
"ubyte" |
|
||||
"ucent" |
|
||||
"uint" |
|
||||
"ulong" |
|
||||
"ushort" |
|
||||
"wchar" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Booleans. */
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
/* Standard library (TODO) */
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{ErrorCharLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
{HexStringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedHexStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{WysiwygStringLiteralStart} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(WYSIWYG_STRING_1); }
|
||||
{WysiwygStringLiteralStart2} { addToken(Token.LITERAL_BACKQUOTE); yybegin(WYSIWYG_STRING_2); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{DocCommentBegin} { start = zzMarkedPos-3; yybegin(DOCCOMMENT); }
|
||||
{NestableMLCBegin} { start = zzMarkedPos-2; nestedMlcDepth = 1; yybegin(NESTABLE_MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
{LineDocCommentBegin} { start = zzMarkedPos-3; yybegin(EOL_DOCCOMMENT); }
|
||||
|
||||
/* Annotations. */
|
||||
{Annotation} { addToken(Token.ANNOTATION); }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{BinaryLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as identifiers. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<DOCCOMMENT> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_DOCUMENTATION); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_DOCUMENTATION); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { yybegin(YYINITIAL); addToken(start,zzEndRead, Token.COMMENT_DOCUMENTATION); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<NESTABLE_MLC> {
|
||||
|
||||
[^hwf\n\+\/]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
{NestableMLCBegin} { nestedMlcDepth++; }
|
||||
"/" {}
|
||||
|
||||
"+/" {
|
||||
System.out.println("... " + nestedMlcDepth);
|
||||
if (--nestedMlcDepth==0) {
|
||||
addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); yybegin(YYINITIAL);
|
||||
}
|
||||
}
|
||||
\+ {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addNestedMlcEndToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<EOL_DOCCOMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_DOCUMENTATION); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<WYSIWYG_STRING_1> {
|
||||
[^\"]+ { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\" { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(YYINITIAL); }
|
||||
<<EOF>> {
|
||||
if (firstToken==null) {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
<WYSIWYG_STRING_2> {
|
||||
[^\`]+ { addToken(Token.LITERAL_BACKQUOTE); }
|
||||
\` { addToken(Token.LITERAL_BACKQUOTE); yybegin(YYINITIAL); }
|
||||
<<EOF>> {
|
||||
if (firstToken==null) {
|
||||
addToken(Token.LITERAL_BACKQUOTE);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,660 +0,0 @@
|
||||
/*
|
||||
* 09/01/2014
|
||||
*
|
||||
* DartTokenMaker.java - Token parser for Dart.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for Dart files. Its states could be simplified, but are
|
||||
* kept the way they are to keep a degree of similarity (i.e. copy/paste)
|
||||
* between it and HTML/JSP/PHPTokenMaker. This should cause no difference in
|
||||
* performance.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>DartTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class DartTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a JavaScript multi-line comment.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_MLC = -8;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line JS string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_STRING_INVALID = -10;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line JS string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_STRING_VALID = -11;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line JS single-quoted string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_CHAR_INVALID = -12;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line JS single-quoted string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_CHAR_VALID = -13;
|
||||
|
||||
/**
|
||||
* When in the JS_STRING state, whether the current string is valid.
|
||||
*/
|
||||
private boolean validJSString;
|
||||
|
||||
/**
|
||||
* The version of JavaScript being highlighted.
|
||||
*/
|
||||
private static String jsVersion;
|
||||
|
||||
/**
|
||||
* Language state set on JS tokens. Must be 0.
|
||||
*/
|
||||
private static final int LANG_INDEX_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public DartTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
jsVersion = "1.0";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the closest {@link TokenTypes "standard" token type} for a given
|
||||
* "internal" token type (e.g. one whose value is <code>< 0</code>).
|
||||
*/
|
||||
@Override
|
||||
public int getClosestStandardTokenTypeForInternalType(int type) {
|
||||
switch (type) {
|
||||
case INTERNAL_IN_JS_MLC:
|
||||
return TokenTypes.COMMENT_MULTILINE;
|
||||
case INTERNAL_IN_JS_STRING_INVALID:
|
||||
case INTERNAL_IN_JS_STRING_VALID:
|
||||
case INTERNAL_IN_JS_CHAR_INVALID:
|
||||
case INTERNAL_IN_JS_CHAR_VALID:
|
||||
return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the JavaScript version being highlighted.
|
||||
*
|
||||
* @return Supported JavaScript version.
|
||||
* @see #isJavaScriptCompatible(String)
|
||||
*/
|
||||
public static String getJavaScriptVersion() {
|
||||
return jsVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
validJSString = true;
|
||||
int languageIndex = LANG_INDEX_DEFAULT;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = DART_MULTILINE_STRING_DOUBLE;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = DART_MULTILINE_STRING_SINGLE;
|
||||
break;
|
||||
case INTERNAL_IN_JS_MLC:
|
||||
state = JS_MLC;
|
||||
break;
|
||||
case INTERNAL_IN_JS_STRING_INVALID:
|
||||
state = JS_STRING;
|
||||
validJSString = false;
|
||||
break;
|
||||
case INTERNAL_IN_JS_STRING_VALID:
|
||||
state = JS_STRING;
|
||||
break;
|
||||
case INTERNAL_IN_JS_CHAR_INVALID:
|
||||
state = JS_CHAR;
|
||||
validJSString = false;
|
||||
break;
|
||||
case INTERNAL_IN_JS_CHAR_VALID:
|
||||
state = JS_CHAR;
|
||||
break;
|
||||
default:
|
||||
state = YYINITIAL; // ???
|
||||
break;
|
||||
}
|
||||
|
||||
setLanguageIndex(languageIndex);
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether features for a specific JS version should be honored
|
||||
* while highlighting.
|
||||
*
|
||||
* @param version JavaScript version required
|
||||
* @return Whether the JavaScript version is the same or greater than
|
||||
* version required.
|
||||
*/
|
||||
public static boolean isJavaScriptCompatible(String version) {
|
||||
return jsVersion.compareTo(version) >= 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the supported JavaScript version because some keywords were
|
||||
* introduced on or after this version.
|
||||
*
|
||||
* @param javaScriptVersion The version of JavaScript to support, such as
|
||||
* "<code>1.5</code>" or "<code>1.6</code>".
|
||||
* @see #isJavaScriptCompatible(String)
|
||||
* @see #getJavaScriptVersion()
|
||||
*/
|
||||
public static void setJavaScriptVersion(String javaScriptVersion) {
|
||||
jsVersion = javaScriptVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Whitespace = ([ \t\f]+)
|
||||
LineTerminator = ([\n])
|
||||
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
LetterOrDigit = ({Letter}|{Digit})
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({Letter}|"_"|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
JS_MLCBegin = "/*"
|
||||
JS_MLCEnd = "*/"
|
||||
JS_LineCommentBegin = "//"
|
||||
JS_IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
JS_IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
JS_IntegerLiteral = ({JS_IntegerHelper1}[lL]?)
|
||||
JS_HexLiteral = ({JS_IntegerHelper2}[lL]?)
|
||||
JS_FloatHelper1 = ([fFdD]?)
|
||||
JS_FloatHelper2 = ([eE][+-]?{Digit}+{JS_FloatHelper1})
|
||||
JS_FloatLiteral1 = ({Digit}+"."({JS_FloatHelper1}|{JS_FloatHelper2}|{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2})))
|
||||
JS_FloatLiteral2 = ("."{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2}))
|
||||
JS_FloatLiteral3 = ({Digit}+{JS_FloatHelper2})
|
||||
JS_FloatLiteral = ({JS_FloatLiteral1}|{JS_FloatLiteral2}|{JS_FloatLiteral3}|({Digit}+[fFdD]))
|
||||
JS_ErrorNumberFormat = (({JS_IntegerLiteral}|{JS_HexLiteral}|{JS_FloatLiteral}){NonSeparator}+)
|
||||
JS_Separator = ([\(\)\{\}\[\]\]])
|
||||
JS_Separator2 = ([\;,.])
|
||||
JS_NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"||"|"&&"|">>>")
|
||||
JS_AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
JS_Operator = ({JS_NonAssignmentOperator}|{JS_AssignmentOperator})
|
||||
JS_Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
JS_ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
DART_Annotation = ("@"{Letter}{LetterOrDigit}*)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrDigit}|"_"|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{LetterOrDigit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state JS_STRING
|
||||
%state JS_CHAR
|
||||
%state JS_MLC
|
||||
%state JS_EOL_COMMENT
|
||||
%state DART_MULTILINE_STRING_DOUBLE
|
||||
%state DART_MULTILINE_STRING_SINGLE
|
||||
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
// Keywords
|
||||
"abstract" |
|
||||
"assert" |
|
||||
"class" |
|
||||
"const" |
|
||||
"extends" |
|
||||
"factory" |
|
||||
"get" |
|
||||
"implements" |
|
||||
"import" |
|
||||
"interface" |
|
||||
"library" |
|
||||
"negate" |
|
||||
"new" |
|
||||
"null" |
|
||||
"operator" |
|
||||
"set" |
|
||||
"source" |
|
||||
"static" |
|
||||
"super" |
|
||||
"this" |
|
||||
"typedef" |
|
||||
"var" |
|
||||
"final" |
|
||||
"if" |
|
||||
"else" |
|
||||
"for" |
|
||||
"in" |
|
||||
"is" |
|
||||
"while" |
|
||||
"do" |
|
||||
"switch" |
|
||||
"case" |
|
||||
"default" |
|
||||
"in" |
|
||||
"try" |
|
||||
"catch" |
|
||||
"finally" |
|
||||
"break" |
|
||||
"continue" |
|
||||
"throw" |
|
||||
"assert" { addToken(Token.RESERVED_WORD); }
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
// Literals.
|
||||
"false" |
|
||||
"true" { addToken(Token.LITERAL_BOOLEAN); }
|
||||
"NaN" { addToken(Token.RESERVED_WORD); }
|
||||
"Infinity" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
// Data types
|
||||
"bool" |
|
||||
"int" |
|
||||
"double" |
|
||||
"num" |
|
||||
"void" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
// stdlib types
|
||||
"AssertionError" |
|
||||
"Clock" |
|
||||
"Collection" |
|
||||
"Comparable" |
|
||||
"Date" |
|
||||
"Dispatcher" |
|
||||
"Duration" |
|
||||
"Expect" |
|
||||
"FallThroughError" |
|
||||
"Function" |
|
||||
"HashMap" |
|
||||
"HashSet" |
|
||||
"Hashable" |
|
||||
"Isolate" |
|
||||
"Iterable" |
|
||||
"Iterator" |
|
||||
"LinkedHashMap" |
|
||||
"List" |
|
||||
"Map" |
|
||||
"Match" |
|
||||
"Math" |
|
||||
"Object" |
|
||||
"Pattern" |
|
||||
"Promise" |
|
||||
"Proxy" |
|
||||
"Queue" |
|
||||
"ReceivePort" |
|
||||
"RegExp" |
|
||||
"SendPort" |
|
||||
"Set" |
|
||||
"StopWatch" |
|
||||
"String" |
|
||||
"StringBuffer" |
|
||||
"Strings" |
|
||||
"TimeZone" |
|
||||
"TypeError" |
|
||||
|
||||
// stdlib exceptions
|
||||
"BadNumberFormatException" |
|
||||
"ClosureArgumentMismatchException" |
|
||||
"EmptyQueueException" |
|
||||
"Exception" |
|
||||
"ExpectException" |
|
||||
"IllegalAccessException" |
|
||||
"IllegalArgumentException" |
|
||||
"IllegalJSRegExpException" |
|
||||
"IndexOutOfRangeException" |
|
||||
"IntegerDivisionByZeroException" |
|
||||
"NoMoreElementsException" |
|
||||
"NoSuchMethodException" |
|
||||
"NotImplementedException" |
|
||||
"NullPointerException" |
|
||||
"ObjectNotClosureException" |
|
||||
"OutOfMemoryException" |
|
||||
"StackOverflowException" |
|
||||
"UnsupportedOperationException" |
|
||||
"WrongArgumentCountException" { addToken(Token.FUNCTION); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{JS_Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* Multi-line string literals. */
|
||||
\"\"\" { start = zzMarkedPos-3; yybegin(DART_MULTILINE_STRING_DOUBLE); }
|
||||
\'\'\' { start = zzMarkedPos-3; yybegin(DART_MULTILINE_STRING_SINGLE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
[\'] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_CHAR); }
|
||||
[\"] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_STRING); }
|
||||
|
||||
{DART_Annotation} { addToken(Token.ANNOTATION); }
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{JS_MLCBegin} { start = zzMarkedPos-2; yybegin(JS_MLC); }
|
||||
{JS_LineCommentBegin} { start = zzMarkedPos-2; yybegin(JS_EOL_COMMENT); }
|
||||
|
||||
/* Deprecated stuff */
|
||||
"#library" |
|
||||
"#import" |
|
||||
"#source" |
|
||||
"#resource" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Separators. */
|
||||
{JS_Separator} { addToken(Token.SEPARATOR); }
|
||||
{JS_Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{JS_Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{JS_IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{JS_HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{JS_FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{JS_ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{JS_ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<DART_MULTILINE_STRING_DOUBLE> {
|
||||
[^\"\\\n]* {}
|
||||
\\.? { /* Skip escaped chars, handles case: '\"""'. */ }
|
||||
\"\"\" { addToken(start,zzStartRead+2, Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(YYINITIAL); }
|
||||
\" {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<DART_MULTILINE_STRING_SINGLE> {
|
||||
[^\'\\\n]* {}
|
||||
\\.? { /* Skip escaped chars, handles case: "\'''". */ }
|
||||
\'\'\' { addToken(start,zzStartRead+2, Token.LITERAL_CHAR); yybegin(YYINITIAL); }
|
||||
\' {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_STRING_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_STRING_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\" { int type = validJSString ? Token.LITERAL_STRING_DOUBLE_QUOTE : Token.ERROR_STRING_DOUBLE; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_CHAR> {
|
||||
[^\n\\\']+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_CHAR);
|
||||
addEndToken(INTERNAL_IN_JS_CHAR_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_CHAR);
|
||||
addEndToken(INTERNAL_IN_JS_CHAR_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\' { int type = validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_MLC> {
|
||||
// JavaScript MLC's. This state is essentially Java's MLC state.
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
{JS_MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,559 +0,0 @@
|
||||
/*
|
||||
* 7/28/2009
|
||||
*
|
||||
* DelphiTokenMaker.java - Scanner for the Delphi programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Delphi programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>DelphiTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class DelphiTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Token type specific to DelphiTokenMaker; denotes a line ending
|
||||
* with an unterminated "(*" comment.
|
||||
*/
|
||||
public static final int INTERNAL_MLC2 = -1;
|
||||
|
||||
/**
|
||||
* Token type specific to DelphiTokenMaker; denotes a line ending
|
||||
* with an unterminated "{$" compiler directive.
|
||||
*/
|
||||
public static final int INTERNAL_COMPILER_DIRECTIVE = -2;
|
||||
|
||||
/**
|
||||
* Token type specific to DelphiTokenMaker; denotes a line ending
|
||||
* with an unterminated "(*$" compiler directive.
|
||||
*/
|
||||
public static final int INTERNAL_COMPILER_DIRECTIVE2 = -3;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public DelphiTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_MLC2:
|
||||
state = MLC2;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_COMPILER_DIRECTIVE:
|
||||
state = COMPILER_DIRECTIVE;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_COMPILER_DIRECTIVE2:
|
||||
state = COMPILER_DIRECTIVE2;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit})
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
UnclosedStringLiteral = ([\'][^\']*)
|
||||
StringLiteral = ({UnclosedStringLiteral}[\'])
|
||||
EscapeSequence = ("#"{Digit}*)
|
||||
|
||||
MLCBegin = "{"
|
||||
MLCEnd = "}"
|
||||
MLC2Begin = "(*"
|
||||
MLC2End = "*)"
|
||||
CompilerDirective1Begin = ({MLCBegin}"$")
|
||||
CompilerDirective2Begin = ({MLC2Begin}"$")
|
||||
LineCommentBegin = "//"
|
||||
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\(\)\[\]])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
Operator = ([\^\@\:\=\<\>\+\-\/\*])
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state MLC
|
||||
%state MLC2
|
||||
%state COMPILER_DIRECTIVE
|
||||
%state COMPILER_DIRECTIVE2
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"array" |
|
||||
"as" |
|
||||
"at" |
|
||||
"asm" |
|
||||
"begin" |
|
||||
"case" |
|
||||
"class" |
|
||||
"const" |
|
||||
"constructor" |
|
||||
"destructor" |
|
||||
"dispinterface" |
|
||||
"div" |
|
||||
"do" |
|
||||
"downto" |
|
||||
"else" |
|
||||
"end" |
|
||||
"except" |
|
||||
"exports" |
|
||||
"file" |
|
||||
"final" |
|
||||
"finalization" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"function" |
|
||||
"goto" |
|
||||
"if" |
|
||||
"implementation" |
|
||||
"in" |
|
||||
"inherited" |
|
||||
"initialization" |
|
||||
"inline" |
|
||||
"interface" |
|
||||
"is" |
|
||||
"label" |
|
||||
"mod" |
|
||||
"not" |
|
||||
"object" |
|
||||
"of" |
|
||||
"on" |
|
||||
"or" |
|
||||
"out" |
|
||||
"packed" |
|
||||
"procedure" |
|
||||
"program" |
|
||||
"property" |
|
||||
"raise" |
|
||||
"record" |
|
||||
"repeat" |
|
||||
"resourcestring" |
|
||||
"set" |
|
||||
"sealed" |
|
||||
"shl" |
|
||||
"shr" |
|
||||
"static" |
|
||||
"string" |
|
||||
"then" |
|
||||
"threadvar" |
|
||||
"to" |
|
||||
"try" |
|
||||
"type" |
|
||||
"unit" |
|
||||
"unsafe" |
|
||||
"until" |
|
||||
"uses" |
|
||||
"var" |
|
||||
"while" |
|
||||
"with" |
|
||||
"xor" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Directives. */
|
||||
"absolute" |
|
||||
"abstract" |
|
||||
"assembler" |
|
||||
"automated" |
|
||||
"cdecl" |
|
||||
"contains" |
|
||||
"default" |
|
||||
"deprecated" |
|
||||
"dispid" |
|
||||
"dynamic" |
|
||||
"export" |
|
||||
"external" |
|
||||
"far" |
|
||||
"forward" |
|
||||
"implements" |
|
||||
"index" |
|
||||
"library" |
|
||||
"local" |
|
||||
"message" |
|
||||
"name" |
|
||||
"namespaces" |
|
||||
"near" |
|
||||
"nil" |
|
||||
"nodefault" |
|
||||
"overload" |
|
||||
"override" |
|
||||
"package" |
|
||||
"pascal" |
|
||||
"platform" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"published" |
|
||||
"read" |
|
||||
"readonly" |
|
||||
"register" |
|
||||
"reintroduce" |
|
||||
"requires" |
|
||||
"resident" |
|
||||
"safecall" |
|
||||
"self" |
|
||||
"stdcall" |
|
||||
"stored" |
|
||||
"varargs" |
|
||||
"virtual" |
|
||||
"write" |
|
||||
"writeonly" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Data types. */
|
||||
"shortint" |
|
||||
"byte" |
|
||||
"char" |
|
||||
"smallint" |
|
||||
"integer" |
|
||||
"word" |
|
||||
"longint" |
|
||||
"cardinal" |
|
||||
"boolean" |
|
||||
"bytebool" |
|
||||
"wordbool" |
|
||||
"longbool" |
|
||||
"real" |
|
||||
"single" |
|
||||
"double" |
|
||||
"extended" |
|
||||
"comp" |
|
||||
"currency" |
|
||||
"pointer" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{EscapeSequence} { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
/* Comment literals. */
|
||||
{CompilerDirective1Begin} {start = zzMarkedPos-2; yybegin(COMPILER_DIRECTIVE); }
|
||||
{CompilerDirective2Begin} {start = zzMarkedPos-3; yybegin(COMPILER_DIRECTIVE2); }
|
||||
{MLCBegin} { start = zzMarkedPos-1; yybegin(MLC); }
|
||||
{MLC2Begin} { start = zzMarkedPos-2; yybegin(MLC2); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\}]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.COMMENT_MULTILINE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<MLC2> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_MLC2); return firstToken; }
|
||||
{MLC2End} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_MLC2); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<COMPILER_DIRECTIVE> {
|
||||
[^\n\}]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_COMPILER_DIRECTIVE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.PREPROCESSOR); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_COMPILER_DIRECTIVE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<COMPILER_DIRECTIVE2> {
|
||||
[^\n\*]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_COMPILER_DIRECTIVE2); return firstToken; }
|
||||
{MLC2End} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.PREPROCESSOR); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_COMPILER_DIRECTIVE2); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,282 +0,0 @@
|
||||
/*
|
||||
* 11/24/2015
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for Dockerfiles.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>DockerTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class DockerTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public DockerTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether tokens of the specified type should have "mark
|
||||
* occurrences" enabled for the current programming language.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences"
|
||||
* enabled.
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type==Token.IDENTIFIER || type==Token.RESERVED_WORD;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = TokenTypes.NULL;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
Digit = [0-9]
|
||||
IdentifierPart = ({Letter}|{Digit}|[_\-\.])
|
||||
Identifier = ({IdentifierPart}|{IdentifierPart}*)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
%state STRING
|
||||
%state CHAR_LITERAL
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"maintainer" |
|
||||
"from" |
|
||||
"onbuild" |
|
||||
"run" |
|
||||
"expose" |
|
||||
"env" |
|
||||
"add" |
|
||||
"copy" |
|
||||
"volume" |
|
||||
"user" |
|
||||
"workdir" |
|
||||
"cmd" |
|
||||
"entrypoint" |
|
||||
"label" |
|
||||
"arg" |
|
||||
"stopsignal" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
"[" |
|
||||
"]" { addToken(Token.SEPARATOR); }
|
||||
|
||||
"|" |
|
||||
">" |
|
||||
">>" { addToken(Token.OPERATOR); }
|
||||
|
||||
/* String/Character literals. */
|
||||
\" { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
\' { start = zzMarkedPos-1; yybegin(CHAR_LITERAL); }
|
||||
|
||||
/* Comment literals. */
|
||||
"#".* { addToken(Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
"\n" |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
<CHAR_LITERAL> {
|
||||
[^\n\\\']+ {}
|
||||
\\.? { /* Skip escaped single quotes only, but this should still work. */ }
|
||||
\' { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
}
|
||||
@@ -1,696 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 11/25/15 12:02 AM */
|
||||
/*
|
||||
* 11/24/2015
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenTypes;
|
||||
|
||||
/**
|
||||
* Scanner for Dockerfiles.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>DockerTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class DockerTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int STRING = 1;
|
||||
public static final int CHAR_LITERAL = 2;
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\2\1\37\1\0\1\2\23\0\1\2\1\0\1\34\1\36"
|
||||
+ "\3\0\1\35\5\0\2\1\1\0\12\1\4\0\1\33\2\0\1\4" + "\1\14\1\24\1\17\1\10\1\12\1\30\1\1\1\5\1\1\1\27"
|
||||
+ "\1\16\1\3\1\6\1\13\1\21\1\1\1\11\1\22\1\7\1\15" + "\1\23\1\26\1\20\1\25\1\1\1\31\1\40\1\31\1\0\1\1"
|
||||
+ "\1\0\1\4\1\14\1\24\1\17\1\10\1\12\1\30\1\1\1\5" + "\1\1\1\27\1\16\1\3\1\6\1\13\1\21\1\1\1\11\1\22"
|
||||
+ "\1\7\1\15\1\23\1\26\1\20\1\25\1\1\1\0\1\32\uff83\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\1\1\2\0\2\1\1\2\14\1\1\3\2\4\1\5"
|
||||
+ "\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\11" + "\1\15\1\16\1\17\16\1\1\14\1\17\1\1\1\20" + "\41\1";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[84];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\41\0\102\0\143\0\204\0\245\0\306\0\347"
|
||||
+ "\0\u0108\0\u0129\0\u014a\0\u016b\0\u018c\0\u01ad\0\u01ce\0\u01ef"
|
||||
+ "\0\u0210\0\u0231\0\143\0\143\0\u0252\0\143\0\143\0\u0273"
|
||||
+ "\0\143\0\u0294\0\143\0\143\0\u02b5\0\u02d6\0\143\0\143"
|
||||
+ "\0\u02f7\0\u0318\0\u0339\0\u035a\0\u037b\0\u039c\0\u03bd\0\u03de"
|
||||
+ "\0\u03ff\0\u0420\0\u0441\0\u0462\0\u0483\0\u04a4\0\u04c5\0\143"
|
||||
+ "\0\143\0\u04e6\0\204\0\u0507\0\u0528\0\u0549\0\u056a\0\u058b"
|
||||
+ "\0\u05ac\0\u05cd\0\u05ee\0\u060f\0\u0630\0\u0651\0\u0672\0\u0693"
|
||||
+ "\0\u06b4\0\u06d5\0\u06f6\0\u0717\0\u0738\0\u0759\0\u077a\0\u079b"
|
||||
+ "\0\u07bc\0\u07dd\0\u07fe\0\u081f\0\u0840\0\u0861\0\u0882\0\u08a3" + "\0\u08c4\0\u08e5\0\u0906\0\u0927";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[84];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\4\1\5\1\6\1\7\1\10\3\5\1\11\1\12"
|
||||
+ "\1\13\1\14\1\5\1\15\1\16\3\5\1\17\1\20" + "\1\21\1\5\1\22\2\5\1\23\1\24\1\25\1\26"
|
||||
+ "\1\27\1\30\1\31\1\4\34\32\1\33\2\32\1\34" + "\1\35\35\36\1\37\1\36\1\40\1\41\42\0\1\5"
|
||||
+ "\1\0\26\5\12\0\1\6\37\0\1\5\1\0\1\5" + "\1\42\24\5\11\0\1\5\1\0\6\5\1\43\5\5"
|
||||
+ "\1\44\11\5\11\0\1\5\1\0\3\5\1\45\11\5" + "\1\46\10\5\11\0\1\5\1\0\12\5\1\47\13\5"
|
||||
+ "\11\0\1\5\1\0\6\5\1\50\17\5\11\0\1\5" + "\1\0\3\5\1\51\22\5\11\0\1\5\1\0\17\5"
|
||||
+ "\1\52\6\5\11\0\1\5\1\0\1\5\1\53\24\5" + "\11\0\1\5\1\0\4\5\1\54\21\5\11\0\1\5"
|
||||
+ "\1\0\10\5\1\55\15\5\11\0\1\5\1\0\1\44" + "\7\5\1\56\15\5\11\0\1\5\1\0\10\5\1\57"
|
||||
+ "\15\5\43\0\1\24\5\0\37\30\1\0\1\30\34\32" + "\1\0\2\32\2\0\37\60\1\0\1\60\35\36\1\0"
|
||||
+ "\1\36\2\0\37\61\1\0\1\61\1\0\1\5\1\0" + "\2\5\1\62\23\5\11\0\1\5\1\0\25\5\1\63"
|
||||
+ "\11\0\1\5\1\0\14\5\1\63\11\5\11\0\1\5" + "\1\0\4\5\1\64\13\5\1\63\5\5\11\0\1\5"
|
||||
+ "\1\0\16\5\1\65\7\5\11\0\1\5\1\0\3\5" + "\1\63\22\5\11\0\1\5\1\0\10\5\1\66\15\5"
|
||||
+ "\11\0\1\5\1\0\11\5\1\67\14\5\11\0\1\5" + "\1\0\5\5\1\70\20\5\11\0\1\5\1\0\11\5"
|
||||
+ "\1\71\14\5\11\0\1\5\1\0\10\5\1\72\15\5" + "\11\0\1\5\1\0\13\5\1\73\12\5\11\0\1\5"
|
||||
+ "\1\0\16\5\1\74\7\5\11\0\1\5\1\0\6\5" + "\1\75\17\5\11\0\1\5\1\0\3\5\1\76\22\5"
|
||||
+ "\11\0\1\5\1\0\6\5\1\77\17\5\11\0\1\5" + "\1\0\10\5\1\100\15\5\11\0\1\5\1\0\1\63"
|
||||
+ "\25\5\11\0\1\5\1\0\12\5\1\101\13\5\11\0" + "\1\5\1\0\6\5\1\63\17\5\11\0\1\5\1\0"
|
||||
+ "\5\5\1\102\20\5\11\0\1\5\1\0\16\5\1\103" + "\7\5\11\0\1\5\1\0\12\5\1\104\13\5\11\0"
|
||||
+ "\1\5\1\0\22\5\1\63\3\5\11\0\1\5\1\0" + "\24\5\1\105\1\5\11\0\1\5\1\0\4\5\1\106"
|
||||
+ "\21\5\11\0\1\5\1\0\22\5\1\107\3\5\11\0" + "\1\5\1\0\17\5\1\110\6\5\11\0\1\5\1\0"
|
||||
+ "\2\5\1\111\23\5\11\0\1\5\1\0\13\5\1\63" + "\12\5\11\0\1\5\1\0\17\5\1\112\6\5\11\0"
|
||||
+ "\1\5\1\0\1\110\25\5\11\0\1\5\1\0\14\5" + "\1\113\11\5\11\0\1\5\1\0\1\5\1\114\24\5"
|
||||
+ "\11\0\1\5\1\0\16\5\1\115\7\5\11\0\1\5" + "\1\0\5\5\1\63\20\5\11\0\1\5\1\0\13\5"
|
||||
+ "\1\44\12\5\11\0\1\5\1\0\2\5\1\116\23\5" + "\11\0\1\5\1\0\2\5\1\70\23\5\11\0\1\5"
|
||||
+ "\1\0\2\5\1\117\23\5\11\0\1\5\1\0\10\5" + "\1\120\15\5\11\0\1\5\1\0\25\5\1\121\11\0"
|
||||
+ "\1\5\1\0\3\5\1\52\22\5\11\0\1\5\1\0" + "\2\5\1\122\23\5\11\0\1\5\1\0\3\5\1\123"
|
||||
+ "\22\5\11\0\1\5\1\0\3\5\1\124\22\5\11\0" + "\1\5\1\0\1\5\1\102\24\5\11\0\1\5\1\0" + "\4\5\1\63\21\5\10\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[2376];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\1\2\0\1\11\16\1\2\11\1\1\2\11\1\1"
|
||||
+ "\1\11\1\1\2\11\2\1\2\11\17\1\2\11\43\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[84];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public DockerTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether tokens of the specified type should have "mark occurrences"
|
||||
* enabled for the current programming language.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences" enabled.
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type == Token.IDENTIFIER || type == Token.RESERVED_WORD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = TokenTypes.NULL;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public DockerTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public DockerTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 160) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 16: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 12: { /* Skip escaped chars. */
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 15: { /*
|
||||
* Skip escaped single quotes only, but this should still work.
|
||||
*/
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 5: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(STRING);
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 13: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead, Token.LITERAL_CHAR);
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 10: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 8: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 9: {
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 6: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(CHAR_LITERAL);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case STRING: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 85:
|
||||
break;
|
||||
case CHAR_LITERAL: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
case 86:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 87:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
/*
|
||||
* 04/12/2012
|
||||
*
|
||||
* DtdTokenMaker.java - Generates tokens for DTD syntax highlighting.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for DTD files.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>XMLTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class DtdTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an
|
||||
* unclosed XML tag; thus a new line is beginning still inside of the tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_START = -1;
|
||||
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an
|
||||
* unclosed DOCTYPE element.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_ELEMENT = -2;
|
||||
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an
|
||||
* unclosed, locally-defined DTD in a DOCTYPE element.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_ATTLIST = -3;
|
||||
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an
|
||||
* unclosed comment. The state to return to when this comment ends is
|
||||
* embedded in the token type as well.
|
||||
*/
|
||||
public static final int INTERNAL_IN_COMMENT = -(1<<11);
|
||||
|
||||
/**
|
||||
* The state we were in prior to the current one. This is used to know
|
||||
* what state to resume after an MLC ends.
|
||||
*/
|
||||
private int prevState;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public DtdTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Always returns <tt>false</tt>, as you never want "mark occurrences"
|
||||
* working in XML files.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences"
|
||||
* enabled.
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
prevState = YYINITIAL;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_INTAG_START:
|
||||
state = INTAG_START;
|
||||
break;
|
||||
case INTERNAL_INTAG_ELEMENT:
|
||||
state = INTAG_ELEMENT;
|
||||
break;
|
||||
case INTERNAL_INTAG_ATTLIST:
|
||||
state = INTAG_ATTLIST;
|
||||
break;
|
||||
default:
|
||||
if (initialTokenType<-1024) { // INTERNAL_IN_COMMENT - prevState
|
||||
int main = -(-initialTokenType & 0xffffff00);
|
||||
switch (main) {
|
||||
default: // Should never happen
|
||||
case INTERNAL_IN_COMMENT:
|
||||
state = COMMENT;
|
||||
break;
|
||||
}
|
||||
prevState = -initialTokenType&0xff;
|
||||
}
|
||||
else { // Shouldn't happen
|
||||
state = YYINITIAL;
|
||||
}
|
||||
}
|
||||
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Whitespace = ([ \t\f])
|
||||
LineTerminator = ([\n])
|
||||
UnclosedString = ([\"][^\"]*)
|
||||
UnclosedChar = ([\'][^\']*)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ([A-Za-z_0-9\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$A-Za-z0-9])
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state COMMENT
|
||||
%state INTAG_START
|
||||
%state INTAG_ELEMENT
|
||||
%state INTAG_ATTLIST
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
([^ \t\f<]+) { /* Not really valid */ addToken(Token.IDENTIFIER); }
|
||||
"<!--" { start = zzStartRead; prevState = zzLexicalState; yybegin(COMMENT); }
|
||||
"<!" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG_START); }
|
||||
"<" { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<COMMENT> {
|
||||
[^hwf\n\-]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addHyperlinkToken(temp,zzMarkedPos-1, Token.MARKUP_COMMENT); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
"-->" { int temp = zzMarkedPos; addToken(start,zzStartRead+2, Token.MARKUP_COMMENT); start = temp; yybegin(prevState); }
|
||||
"-" {}
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addEndToken(INTERNAL_IN_COMMENT - prevState); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG_START> {
|
||||
("ELEMENT") { addToken(Token.MARKUP_TAG_NAME); yybegin(INTAG_ELEMENT); }
|
||||
("ATTLIST") { addToken(Token.MARKUP_TAG_NAME); yybegin(INTAG_ATTLIST); }
|
||||
([^ \t\f>]+) { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
(">") { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(YYINITIAL); }
|
||||
<<EOF>> { addEndToken(INTERNAL_INTAG_START); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG_ELEMENT> {
|
||||
([^ \t\f>]+) { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
(">") { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(YYINITIAL); }
|
||||
<<EOF>> { addEndToken(INTERNAL_INTAG_ELEMENT); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG_ATTLIST> {
|
||||
("CDATA"|"#IMPLIED"|"#REQUIRED") { addToken(Token.MARKUP_PROCESSING_INSTRUCTION); }
|
||||
([^ \t\f>\"\']+) { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
({UnclosedString}[\"]?) { addToken(Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
({UnclosedChar}[\']?) { addToken(Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
(">") { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(YYINITIAL); }
|
||||
<<EOF>> { addEndToken(INTERNAL_INTAG_ATTLIST); return firstToken; }
|
||||
}
|
||||
@@ -1,769 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 7/9/16 6:48 PM */
|
||||
/*
|
||||
* 04/12/2012
|
||||
* DtdTokenMaker.java - Generates tokens for DTD syntax highlighting.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for DTD files.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>XMLTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DtdTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int INTAG_START = 2;
|
||||
public static final int INTAG_ELEMENT = 3;
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int INTAG_ATTLIST = 4;
|
||||
public static final int COMMENT = 1;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\1\1\2\1\0\1\1\23\0\1\1\1\24\1\3\1\41"
|
||||
+ "\1\7\1\5\1\5\1\4\5\5\1\25\1\22\1\6\12\7\1\20" + "\1\5\1\23\1\5\1\26\2\5\1\34\1\7\1\37\1\40\1\27"
|
||||
+ "\3\7\1\35\2\7\1\30\1\31\1\32\1\7\1\42\1\44\1\43" + "\1\36\1\33\1\45\5\7\1\5\1\0\1\5\1\0\1\5\1\0"
|
||||
+ "\4\7\1\17\1\14\1\7\1\10\1\15\2\7\1\16\3\7\1\12" + "\2\7\1\13\1\11\2\7\1\21\3\7\3\0\1\5\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\5\0\1\1\1\2\1\3\1\4\1\5\4\4\1\3"
|
||||
+ "\1\6\2\3\2\7\2\10\2\7\1\11\5\0\2\3" + "\1\10\3\7\5\0\1\12\2\3\3\7\1\13\2\0"
|
||||
+ "\1\14\2\3\3\7\2\0\2\3\1\15\2\7\2\3" + "\2\7\1\16\1\17\1\7";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[70];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\46\0\114\0\162\0\230\0\276\0\344\0\u010a"
|
||||
+ "\0\u0130\0\u0156\0\u017c\0\u01a2\0\u01c8\0\u01ee\0\u0214\0\u0156"
|
||||
+ "\0\u023a\0\u0260\0\u0286\0\u02ac\0\u02d2\0\u02f8\0\u031e\0\u0344"
|
||||
+ "\0\u036a\0\u0390\0\u03b6\0\u03dc\0\u0402\0\u0428\0\u044e\0\u0474"
|
||||
+ "\0\u0156\0\u049a\0\u04c0\0\u04e6\0\u050c\0\u0532\0\u0558\0\u057e"
|
||||
+ "\0\u05a4\0\u0156\0\u05ca\0\u05f0\0\u0616\0\u063c\0\u0662\0\u0156"
|
||||
+ "\0\u0688\0\u06ae\0\u06d4\0\u06fa\0\u0720\0\u0746\0\u076c\0\u0792"
|
||||
+ "\0\u07b8\0\u06d4\0\u07de\0\u0804\0\u02ac\0\u082a\0\u0850\0\u0876"
|
||||
+ "\0\u089c\0\u08c2\0\u08e8\0\u0214\0\u0214\0\u090e";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[70];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\6\1\7\21\6\1\10\22\6\2\11\1\12\5\11"
|
||||
+ "\1\13\3\11\1\14\4\11\1\15\3\11\1\16\20\11" + "\1\17\1\7\24\17\1\20\1\21\4\17\1\22\11\17"
|
||||
+ "\1\23\1\7\24\23\1\20\17\23\1\24\1\7\1\24" + "\1\25\1\26\21\24\1\20\10\24\1\27\1\24\1\30"
|
||||
+ "\4\24\1\6\1\0\21\6\1\0\22\6\1\0\1\7" + "\70\0\1\31\21\0\2\11\1\0\5\11\1\0\3\11"
|
||||
+ "\1\0\4\11\1\0\3\11\1\0\20\11\57\0\1\32" + "\45\0\1\33\3\0\1\34\51\0\1\35\51\0\1\36"
|
||||
+ "\20\0\1\17\1\0\24\17\1\0\20\17\1\0\24\17" + "\1\0\1\17\1\37\16\17\1\0\24\17\1\0\4\17"
|
||||
+ "\1\40\12\17\1\23\1\0\24\23\1\0\17\23\1\24" + "\1\0\1\24\2\0\21\24\1\0\17\24\3\25\1\41"
|
||||
+ "\42\25\4\26\1\41\41\26\1\24\1\0\1\24\2\0" + "\21\24\1\0\11\24\1\42\6\24\1\0\1\24\2\0"
|
||||
+ "\21\24\1\0\6\24\1\43\5\24\1\44\2\24\25\0" + "\1\45\31\0\1\46\46\0\1\47\51\0\1\50\50\0"
|
||||
+ "\1\51\52\0\1\52\17\0\1\17\1\0\24\17\1\0" + "\1\53\17\17\1\0\24\17\1\0\4\17\1\54\12\17"
|
||||
+ "\1\24\1\0\1\24\2\0\21\24\1\0\5\24\1\55" + "\12\24\1\0\1\24\2\0\21\24\1\0\2\24\1\56"
|
||||
+ "\15\24\1\0\1\24\2\0\21\24\1\0\1\57\16\24" + "\25\0\1\60\32\0\1\61\53\0\1\62\44\0\1\47"
|
||||
+ "\50\0\1\63\23\0\1\17\1\0\24\17\1\0\2\17" + "\1\64\15\17\1\0\24\17\1\0\1\17\1\65\15\17"
|
||||
+ "\1\24\1\0\1\24\2\0\21\24\1\0\4\24\1\66" + "\13\24\1\0\1\24\2\0\21\24\1\0\13\24\1\67"
|
||||
+ "\4\24\1\0\1\24\2\0\21\24\1\0\15\24\1\70" + "\1\24\13\0\1\47\4\0\1\62\33\0\1\71\43\0"
|
||||
+ "\2\72\12\63\1\72\1\63\1\72\1\0\2\72\1\0" + "\12\63\1\72\4\63\1\17\1\0\24\17\1\0\1\73"
|
||||
+ "\17\17\1\0\24\17\1\0\6\17\1\74\10\17\1\24" + "\1\0\1\24\2\0\21\24\1\0\5\24\1\75\12\24"
|
||||
+ "\1\0\1\24\2\0\21\24\1\0\1\24\1\76\16\24" + "\1\0\1\24\2\0\21\24\1\0\16\24\1\77\6\0"
|
||||
+ "\1\63\37\0\1\17\1\0\24\17\1\0\3\17\1\100" + "\14\17\1\0\24\17\1\0\7\17\1\101\7\17\1\24"
|
||||
+ "\1\0\1\24\2\0\21\24\1\0\6\24\1\102\11\24" + "\1\0\1\24\2\0\21\24\1\0\6\24\1\103\10\24"
|
||||
+ "\1\17\1\0\24\17\1\0\4\17\1\104\13\17\1\0" + "\24\17\1\0\4\17\1\105\12\17\1\24\1\0\1\24"
|
||||
+ "\2\0\21\24\1\0\1\106\17\24\1\0\1\24\2\0" + "\21\24\1\0\14\24\1\102\3\24\1\0\1\24\2\0"
|
||||
+ "\21\24\1\0\11\24\1\75\5\24";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[2356];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\5\0\4\1\1\11\5\1\1\11\11\1\5\0\2\1"
|
||||
+ "\1\11\3\1\5\0\1\11\5\1\1\11\2\0\6\1" + "\2\0\14\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[70];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an unclosed
|
||||
* XML tag; thus a new line is beginning still inside of the tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_START = -1;
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an unclosed
|
||||
* DOCTYPE element.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_ELEMENT = -2;
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an unclosed,
|
||||
* locally-defined DTD in a DOCTYPE element.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_ATTLIST = -3;
|
||||
/**
|
||||
* Token type specific to XMLTokenMaker denoting a line ending with an unclosed
|
||||
* comment. The state to return to when this comment ends is embedded in the
|
||||
* token type as well.
|
||||
*/
|
||||
public static final int INTERNAL_IN_COMMENT = -(1 << 11);
|
||||
/**
|
||||
* The state we were in prior to the current one. This is used to know what
|
||||
* state to resume after an MLC ends.
|
||||
*/
|
||||
private int prevState;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public DtdTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an "end
|
||||
* token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos, zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns <tt>false</tt>, as you never want "mark occurrences" working
|
||||
* in XML files.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences" enabled.
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
prevState = YYINITIAL;
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_INTAG_START:
|
||||
state = INTAG_START;
|
||||
break;
|
||||
case INTERNAL_INTAG_ELEMENT:
|
||||
state = INTAG_ELEMENT;
|
||||
break;
|
||||
case INTERNAL_INTAG_ATTLIST:
|
||||
state = INTAG_ATTLIST;
|
||||
break;
|
||||
default:
|
||||
if (initialTokenType < -1024) { // INTERNAL_IN_COMMENT -
|
||||
// prevState
|
||||
int main = -(-initialTokenType & 0xffffff00);
|
||||
switch (main) {
|
||||
default: // Should never happen
|
||||
case INTERNAL_IN_COMMENT:
|
||||
state = COMMENT;
|
||||
break;
|
||||
}
|
||||
prevState = -initialTokenType & 0xff;
|
||||
} else { // Shouldn't happen
|
||||
state = YYINITIAL;
|
||||
}
|
||||
}
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public DtdTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public DtdTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 138) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 3: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 16:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 1: {
|
||||
/* Not really valid */ addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 12: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.MARKUP_COMMENT);
|
||||
addHyperlinkToken(temp, zzMarkedPos - 1, Token.MARKUP_COMMENT);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 9: {
|
||||
addToken(Token.MARKUP_TAG_DELIMITER);
|
||||
yybegin(INTAG_START);
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.MARKUP_TAG_DELIMITER);
|
||||
yybegin(YYINITIAL);
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 10: {
|
||||
int temp = zzMarkedPos;
|
||||
addToken(start, zzStartRead + 2, Token.MARKUP_COMMENT);
|
||||
start = temp;
|
||||
yybegin(prevState);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 11: {
|
||||
start = zzStartRead;
|
||||
prevState = zzLexicalState;
|
||||
yybegin(COMMENT);
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.MARKUP_TAG_ATTRIBUTE);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 15: {
|
||||
addToken(Token.MARKUP_TAG_NAME);
|
||||
yybegin(INTAG_ATTLIST);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(Token.MARKUP_TAG_NAME);
|
||||
yybegin(INTAG_ELEMENT);
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 13: {
|
||||
addToken(Token.MARKUP_PROCESSING_INSTRUCTION);
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 4: {
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(start, zzStartRead - 1, Token.MARKUP_COMMENT);
|
||||
addEndToken(INTERNAL_IN_COMMENT - prevState);
|
||||
return firstToken;
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.MARKUP_TAG_ATTRIBUTE_VALUE);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case INTAG_START: {
|
||||
addEndToken(INTERNAL_INTAG_START);
|
||||
return firstToken;
|
||||
}
|
||||
case 71:
|
||||
break;
|
||||
case INTAG_ELEMENT: {
|
||||
addEndToken(INTERNAL_INTAG_ELEMENT);
|
||||
return firstToken;
|
||||
}
|
||||
case 72:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 73:
|
||||
break;
|
||||
case INTAG_ATTLIST: {
|
||||
addEndToken(INTERNAL_INTAG_ATTLIST);
|
||||
return firstToken;
|
||||
}
|
||||
case 74:
|
||||
break;
|
||||
case COMMENT: {
|
||||
addToken(start, zzStartRead - 1, Token.MARKUP_COMMENT);
|
||||
addEndToken(INTERNAL_IN_COMMENT - prevState);
|
||||
return firstToken;
|
||||
}
|
||||
case 75:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,477 +0,0 @@
|
||||
/*
|
||||
* 03/23/2005
|
||||
*
|
||||
* FortranTokenMaker.java - Scanner for the Fortran programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Fortran programming language.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>FortranTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class FortranTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. We must have this here as there is no default,
|
||||
* no-parameter constructor generated by JFlex.
|
||||
*/
|
||||
public FortranTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "!", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
Column1CommentBegin = ([C\*])
|
||||
Column1Comment2Begin = (D)
|
||||
AnywhereCommentBegin = (\!)
|
||||
|
||||
Identifier = ([A-Za-z0-9_$]+)
|
||||
|
||||
StringDelimiter = (\")
|
||||
CharDelimiter = (\')
|
||||
|
||||
Operators1 = ("<"|">"|"<="|">="|"&"|"/="|"==")
|
||||
Operators2 = (\.(lt|gt|eq|ne|le|ge|and|or)\.)
|
||||
Operator = ({Operators1}|{Operators2})
|
||||
|
||||
Boolean = (\.(true|false)\.)
|
||||
|
||||
%state STRING
|
||||
%state CHAR
|
||||
|
||||
%%
|
||||
|
||||
/* Keywords */
|
||||
<YYINITIAL> "INCLUDE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "PROGRAM" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MODULE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SUBROUTINE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "FUNCTION" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CONTAINS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "USE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CALL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "RETURN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IMPLICIT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "EXPLICIT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "NONE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DATA" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "PARAMETER" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ALLOCATE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ALLOCATABLE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ALLOCATED" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DEALLOCATE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "INTEGER" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "REAL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DOUBLE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "PRECISION" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "COMPLEX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LOGICAL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CHARACTER" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DIMENSION" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "KIND" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CASE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SELECT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DEFAULT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CONTINUE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CYCLE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DO" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "WHILE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ELSE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IF" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ELSEIF" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "THEN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ELSEWHERE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "END" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ENDIF" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ENDDO" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "FORALL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "WHERE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "EXIT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "GOTO" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "PAUSE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "STOP" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "BACKSPACE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CLOSE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ENDFILE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "INQUIRE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "OPEN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "PRINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "READ" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "REWIND" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "WRITE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "FORMAT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AIMAG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMAX0" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMIN0" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ANINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CEILING" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CMPLX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CONJG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DBLE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DCMPLX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DFLOAT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DIM" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DPROD" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "FLOAT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "FLOOR" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IFIX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IMAG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "INT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LOGICAL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MODULO" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "NINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "REAL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SIGN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SNGL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "TRANSFER" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ZEXT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ABS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ACOS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AIMAG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ALOG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ALOG10" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMAX0" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMAX1" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMIN0" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMIN1" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "AMOD" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ANINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ASIN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ATAN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ATAN2" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CABS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CCOS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CHAR" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CLOG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CMPLX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CONJG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "COS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "COSH" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CSIN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "CSQRT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DABS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DACOS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DASIN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DATAN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DATAN2" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DBLE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DCOS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DCOSH" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DDIM" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DEXP" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DIM" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DLOG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DLOG10" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DMAX1" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DMIN1" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DMOD" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DNINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DPROD" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DREAL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DSIGN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DSIN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DSINH" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DSQRT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DTAN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "DTANH" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "EXP" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "FLOAT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IABS" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ICHAR" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IDIM" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IDINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IDNINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "IFIX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "INDEX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "INT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ISIGN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LEN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LGE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LGT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LLE" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LLT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LOG" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "LOG10" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MAX" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MAX0" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MAX1" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MIN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MIN0" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MIN1" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "MOD" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "NINT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "REAL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SIGN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SIN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SINH" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SNGL" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "SQRT" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "TAN" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "TANH" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character Literals. */
|
||||
{CharDelimiter} { start = zzMarkedPos-1; yybegin(CHAR); }
|
||||
{StringDelimiter} { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
|
||||
/* Comment Literals. */
|
||||
/* Note that we cannot combine these as JFLex doesn't like combining an */
|
||||
/* expression containing the beginning-of-line character '^'. */
|
||||
{Column1CommentBegin} {
|
||||
// Since we change zzStartRead, we have the unfortunate
|
||||
// side-effect of not being able to use the '^' operator.
|
||||
// So we must check whether we're really at the beginning
|
||||
// of the line ourselves...
|
||||
if (zzStartRead==s.offset) {
|
||||
addToken(zzStartRead,zzEndRead, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
{Column1Comment2Begin} {
|
||||
// Since we change zzStartRead, we have the unfortunate
|
||||
// side-effect of not being able to use the '^' operator.
|
||||
// So we must check whether we're really at the beginning
|
||||
// of the line ourselves...
|
||||
if (zzStartRead==s.offset) {
|
||||
addToken(zzStartRead,zzEndRead, Token.COMMENT_DOCUMENTATION);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
{AnywhereCommentBegin} { addToken(zzStartRead,zzEndRead, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Boolean literals. */
|
||||
{Boolean} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or char literal. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<CHAR> {
|
||||
[^\'\n]* {}
|
||||
\' { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
}
|
||||
|
||||
<STRING> {
|
||||
[^\"\n]* {}
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
@@ -1,842 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 10/16/06 10:31 AM */
|
||||
/*
|
||||
* 03/23/2005
|
||||
* FortranTokenMaker.java - Scanner for the Fortran programming language.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for the Fortran programming language.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>FortranTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
public class FortranTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int STRING = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int CHAR = 2;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\2\1\1\1\0\1\2\23\0\1\2\1\5\1\10\1\0"
|
||||
+ "\1\6\1\0\1\14\1\11\2\0\1\3\3\0\1\16\1\15\1\45" + "\1\50\1\51\7\6\2\0\1\12\1\13\1\12\2\0\1\25\1\37"
|
||||
+ "\1\7\1\4\1\22\1\31\1\21\1\41\1\33\1\46\1\42\1\17" + "\1\36\1\24\1\26\1\35\1\23\1\27\1\32\1\20\1\30\1\6"
|
||||
+ "\1\44\1\40\1\43\1\47\4\0\1\6\1\0\1\25\1\37\1\34" + "\1\4\1\22\1\31\1\21\1\41\1\33\1\46\1\42\1\17\1\36"
|
||||
+ "\1\24\1\26\1\35\1\23\1\27\1\32\1\20\1\30\1\6\1\44" + "\1\40\1\43\1\47\uff85\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\1\0\2\1\1\2\1\3\1\4\1\5\1\6\1\7"
|
||||
+ "\1\2\1\5\1\10\1\11\1\12\1\2\1\12\24\2" + "\1\1\1\13\1\14\1\1\1\15\1\16\7\2\1\17"
|
||||
+ "\20\2\7\0\41\2\1\17\27\2\1\17\10\2\1\17" + "\3\2\4\0\2\17\3\2\2\17\20\2\1\17\10\2"
|
||||
+ "\2\17\3\2\1\17\2\2\1\17\6\2\1\17\2\0" + "\3\2\1\17\4\2\1\17\26\2\1\0\20\2\1\20" + "\12\2\1\17";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[257];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\52\0\124\0\176\0\176\0\250\0\176\0\322"
|
||||
+ "\0\176\0\374\0\u0126\0\176\0\176\0\u0150\0\u0150\0\176"
|
||||
+ "\0\u017a\0\u01a4\0\u01ce\0\u01f8\0\u0222\0\u024c\0\u0276\0\u02a0"
|
||||
+ "\0\u02ca\0\u02f4\0\u031e\0\u0348\0\u0372\0\u0126\0\u039c\0\u03c6"
|
||||
+ "\0\u03f0\0\u041a\0\u0444\0\u046e\0\u0498\0\176\0\176\0\u04c2"
|
||||
+ "\0\176\0\176\0\u04ec\0\u0516\0\u0540\0\u056a\0\u0594\0\u05be"
|
||||
+ "\0\u05e8\0\u0612\0\u063c\0\u0666\0\u0690\0\u06ba\0\u06e4\0\u070e"
|
||||
+ "\0\u0738\0\u0762\0\u078c\0\u07b6\0\u07e0\0\u080a\0\u0834\0\u085e"
|
||||
+ "\0\u0888\0\u08b2\0\u08dc\0\u0906\0\u0930\0\u095a\0\u0984\0\u09ae"
|
||||
+ "\0\u09d8\0\u0a02\0\u0a2c\0\u0a56\0\u0a80\0\u0aaa\0\u0ad4\0\u0afe"
|
||||
+ "\0\u0b28\0\u0b52\0\u0b7c\0\u0ba6\0\u0bd0\0\u0bfa\0\u0c24\0\u0c4e"
|
||||
+ "\0\u0c78\0\u0ca2\0\u0ccc\0\u0cf6\0\u0d20\0\u0d4a\0\u0d74\0\u0d9e"
|
||||
+ "\0\u0dc8\0\u0df2\0\u0e1c\0\u0e46\0\u0e70\0\u0e9a\0\u0ec4\0\u0eee"
|
||||
+ "\0\u0f18\0\u0f42\0\u0f6c\0\u0f96\0\u0fc0\0\u0fea\0\u1014\0\u103e"
|
||||
+ "\0\u1068\0\u1092\0\u10bc\0\u10e6\0\u1110\0\u113a\0\u1164\0\u118e"
|
||||
+ "\0\u11b8\0\u11e2\0\u120c\0\u1236\0\u1260\0\u128a\0\u12b4\0\u12de"
|
||||
+ "\0\u1308\0\u1332\0\u135c\0\u1386\0\u13b0\0\u13da\0\u1404\0\u142e"
|
||||
+ "\0\u1458\0\u1482\0\u14ac\0\u14d6\0\u1500\0\u152a\0\u1554\0\u157e"
|
||||
+ "\0\u15a8\0\u15d2\0\u15fc\0\374\0\u1626\0\u1650\0\u167a\0\u16a4"
|
||||
+ "\0\u16ce\0\u16f8\0\u1722\0\u174c\0\u1776\0\u17a0\0\u17ca\0\u17f4"
|
||||
+ "\0\u181e\0\u1848\0\u1872\0\u189c\0\u18c6\0\u18f0\0\u191a\0\u1944"
|
||||
+ "\0\u196e\0\u1998\0\u19c2\0\u19ec\0\u1a16\0\u1a40\0\u1a6a\0\u16f8"
|
||||
+ "\0\u1a94\0\u1abe\0\u1ae8\0\u1b12\0\u1b3c\0\u1b66\0\u1b90\0\u1bba"
|
||||
+ "\0\u1be4\0\u1c0e\0\u1c38\0\u174c\0\u1c62\0\u1c8c\0\u1cb6\0\u1ce0"
|
||||
+ "\0\u1d0a\0\u1d34\0\u1d5e\0\u1d88\0\u1db2\0\u1ddc\0\u1e06\0\u1e30"
|
||||
+ "\0\u1e5a\0\u1e84\0\u1eae\0\u1ed8\0\u1f02\0\u1f2c\0\u1b12\0\u1f56"
|
||||
+ "\0\u1f80\0\u1faa\0\u1fd4\0\u1ffe\0\u2028\0\u2052\0\u207c\0\u20a6"
|
||||
+ "\0\u20d0\0\u20fa\0\u2124\0\u214e\0\u2178\0\u21a2\0\u21cc\0\u21f6"
|
||||
+ "\0\u2220\0\u224a\0\u2274\0\u229e\0\u22c8\0\u22f2\0\u231c\0\u2346"
|
||||
+ "\0\u2370\0\u239a\0\u23c4\0\u23ee\0\u2418\0\u2442\0\u246c\0\u2496"
|
||||
+ "\0\u24c0\0\u24ea\0\u2514\0\u253e\0\u2568\0\176\0\u2592\0\u25bc"
|
||||
+ "\0\u25e6\0\u2610\0\u263a\0\u2664\0\u268e\0\u26b8\0\u26e2\0\u270c" + "\0\u13da";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[257];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\4\1\5\1\6\1\7\1\10\1\11\1\12\1\13"
|
||||
+ "\1\14\1\15\1\16\1\17\1\20\1\17\1\21\1\22" + "\1\23\1\24\1\25\1\12\1\26\1\27\1\30\1\31"
|
||||
+ "\1\32\1\33\1\34\1\35\1\36\1\37\1\40\1\41" + "\2\12\1\42\1\12\1\43\2\12\1\44\2\12\1\45"
|
||||
+ "\1\46\6\45\1\47\41\45\1\50\1\51\7\50\1\52" + "\40\50\54\0\1\6\53\0\1\53\1\0\1\12\1\54"
|
||||
+ "\7\0\1\55\1\56\1\12\1\57\1\12\1\60\1\61" + "\1\62\1\63\1\12\1\64\1\65\1\66\1\54\1\67"
|
||||
+ "\1\70\1\71\12\12\4\0\1\12\1\0\2\12\7\0" + "\33\12\4\0\1\12\1\0\1\12\1\72\7\0\1\73"
|
||||
+ "\2\12\1\74\2\12\1\75\1\76\3\12\1\77\1\12" + "\1\72\1\12\1\100\2\12\1\101\1\12\1\102\6\12"
|
||||
+ "\13\0\1\20\55\0\1\103\1\104\1\103\1\105\1\0" + "\1\106\1\107\1\110\2\0\1\111\24\0\1\12\1\0"
|
||||
+ "\2\12\7\0\1\112\1\12\1\112\1\113\3\12\1\114" + "\23\12\4\0\1\12\1\0\2\12\7\0\6\12\1\115"
|
||||
+ "\1\12\1\116\11\12\1\117\10\12\4\0\1\12\1\0" + "\2\12\7\0\7\12\1\120\23\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\1\121\4\12\1\122\13\12\1\123\11\12" + "\4\0\1\12\1\0\2\12\7\0\7\12\1\124\4\12"
|
||||
+ "\1\125\16\12\4\0\1\12\1\0\1\12\1\72\7\0" + "\1\126\1\127\3\12\1\60\5\12\1\130\1\131\1\72"
|
||||
+ "\1\12\1\132\1\133\12\12\4\0\1\12\1\0\2\12" + "\7\0\16\12\1\117\14\12\4\0\1\12\1\0\2\12"
|
||||
+ "\7\0\3\12\1\134\27\12\4\0\1\12\1\0\2\12" + "\7\0\13\12\1\135\17\12\4\0\1\12\1\0\2\12"
|
||||
+ "\7\0\1\136\6\12\1\137\1\12\1\140\21\12\4\0" + "\1\12\1\0\2\12\7\0\1\12\1\141\1\12\1\142"
|
||||
+ "\1\143\1\144\3\12\1\145\2\12\1\146\16\12\4\0" + "\1\147\1\0\1\12\1\150\7\0\5\12\1\151\1\152"
|
||||
+ "\3\12\1\153\1\154\1\12\1\150\1\12\1\155\13\12" + "\4\0\1\12\1\0\2\12\7\0\6\12\1\156\1\12"
|
||||
+ "\1\157\22\12\4\0\1\12\1\0\2\12\7\0\6\12" + "\1\160\1\161\4\12\1\162\16\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\6\12\1\163\24\12\4\0\1\12\1\0" + "\2\12\7\0\14\12\1\164\16\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\10\12\1\165\11\12\1\166\10\12\4\0" + "\1\12\1\0\2\12\7\0\3\12\1\167\27\12\1\45"
|
||||
+ "\1\0\6\45\1\0\41\45\1\50\1\0\7\50\1\0" + "\40\50\4\0\1\12\1\0\2\12\7\0\14\12\1\170"
|
||||
+ "\16\12\4\0\1\12\1\0\2\12\7\0\7\12\1\171" + "\7\12\1\100\13\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\7\12\1\172\23\12\4\0\1\12\1\0\2\12\7\0" + "\6\12\1\115\24\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\6\12\1\173\3\12\1\174\6\12\1\175\11\12\4\0" + "\1\12\1\0\2\12\7\0\14\12\1\125\16\12\4\0"
|
||||
+ "\1\12\1\0\1\12\1\72\7\0\1\12\1\176\11\12" + "\1\130\1\12\1\72\2\12\1\133\12\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\11\12\1\177\21\12\4\0\1\12" + "\1\0\2\12\7\0\3\12\1\200\27\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\1\201\32\12\4\0\1\12\1\0" + "\2\12\7\0\4\12\1\143\7\12\1\146\16\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\5\12\1\202\11\12\1\203" + "\13\12\4\0\1\12\1\0\2\12\7\0\10\12\1\204"
|
||||
+ "\22\12\4\0\1\12\1\0\2\12\7\0\6\12\1\205" + "\1\206\4\12\1\207\16\12\4\0\1\12\1\0\2\12"
|
||||
+ "\7\0\1\135\32\12\4\0\1\12\1\0\2\12\7\0" + "\7\12\1\133\23\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\7\12\1\210\23\12\4\0\1\12\1\0\2\12\7\0" + "\14\12\1\211\16\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\1\212\12\12\1\135\4\12\1\133\12\12\4\0\1\12" + "\1\0\2\12\7\0\5\12\1\213\5\12\1\214\3\12"
|
||||
+ "\1\215\13\12\4\0\1\12\1\0\2\12\7\0\4\12" + "\1\143\7\12\1\113\16\12\4\0\1\12\1\0\2\12"
|
||||
+ "\7\0\16\12\1\216\14\12\4\0\1\12\1\0\2\12" + "\7\0\6\12\1\217\24\12\4\0\1\12\1\0\1\12"
|
||||
+ "\1\71\7\0\15\12\1\71\15\12\20\0\1\220\1\0" + "\1\220\56\0\1\221\45\0\1\220\50\0\1\220\53\0"
|
||||
+ "\1\222\54\0\1\220\47\0\1\223\30\0\1\12\1\0" + "\2\12\7\0\1\12\1\224\1\12\1\224\27\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\5\12\1\224\25\12\4\0" + "\1\12\1\0\2\12\7\0\2\12\1\225\30\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\5\12\1\214\25\12\4\0" + "\1\12\1\0\2\12\7\0\6\12\1\226\24\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\3\12\1\113\27\12\4\0" + "\1\12\1\0\2\12\7\0\1\12\1\227\31\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\13\12\1\230\17\12\4\0" + "\1\231\1\0\2\12\7\0\33\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\14\12\1\202\1\12\1\232\14\12\4\0" + "\1\12\1\0\2\12\7\0\5\12\1\135\25\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\5\12\1\202\25\12\4\0" + "\1\12\1\0\2\12\7\0\1\233\6\12\1\172\23\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\6\12\1\234\24\12" + "\4\0\1\12\1\0\2\12\7\0\14\12\1\113\16\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\5\12\1\202\11\12" + "\1\235\13\12\4\0\1\12\1\0\2\12\7\0\6\12"
|
||||
+ "\1\236\1\206\4\12\1\237\16\12\4\0\1\12\1\0" + "\2\12\7\0\13\12\1\224\17\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\1\12\1\240\4\12\1\241\16\12\1\42" + "\5\12\4\0\1\12\1\0\2\12\7\0\3\12\1\224"
|
||||
+ "\27\12\4\0\1\12\1\0\2\12\7\0\7\12\1\242" + "\23\12\4\0\1\12\1\0\2\12\7\0\10\12\1\243"
|
||||
+ "\22\12\4\0\1\12\1\0\2\12\7\0\5\12\1\244" + "\25\12\4\0\1\12\1\0\2\12\7\0\7\12\1\175"
|
||||
+ "\23\12\4\0\1\12\1\0\2\12\7\0\1\245\32\12" + "\4\0\1\12\1\0\2\12\7\0\10\12\1\202\22\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\2\12\1\212\30\12" + "\4\0\1\12\1\0\2\12\7\0\20\12\1\246\12\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\2\12\1\113\2\12" + "\1\214\25\12\4\0\1\12\1\0\2\12\7\0\5\12"
|
||||
+ "\1\60\6\12\1\247\16\12\4\0\1\12\1\0\2\12" + "\7\0\22\12\1\250\10\12\4\0\1\251\1\0\1\12"
|
||||
+ "\1\252\7\0\1\12\1\253\2\12\1\254\10\12\1\252" + "\15\12\4\0\1\12\1\0\2\12\7\0\20\12\1\133"
|
||||
+ "\12\12\4\0\1\12\1\0\2\12\7\0\14\12\1\255" + "\16\12\4\0\1\12\1\0\2\12\7\0\14\12\1\256"
|
||||
+ "\16\12\4\0\1\12\1\0\2\12\7\0\6\12\1\257" + "\7\12\1\260\14\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\10\12\1\261\1\32\21\12\4\0\1\12\1\0\2\12" + "\7\0\3\12\1\262\3\12\1\263\4\12\1\125\16\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\21\12\1\264\11\12" + "\4\0\1\265\1\0\2\12\7\0\33\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\5\12\1\264\25\12\4\0\1\12" + "\1\0\1\12\1\266\7\0\15\12\1\266\15\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\5\12\1\206\25\12\4\0" + "\1\12\1\0\2\12\7\0\14\12\1\267\16\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\3\12\1\270\10\12\1\71" + "\16\12\4\0\1\12\1\0\2\12\7\0\21\12\1\202"
|
||||
+ "\11\12\4\0\1\12\1\0\2\12\7\0\17\12\1\224" + "\13\12\4\0\1\12\1\0\2\12\7\0\13\12\1\214"
|
||||
+ "\17\12\4\0\1\12\1\0\2\12\7\0\2\12\1\271" + "\30\12\4\0\1\12\1\0\2\12\7\0\1\272\32\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\6\12\1\273\24\12" + "\4\0\1\12\1\0\2\12\7\0\16\12\1\224\14\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\6\12\1\274\24\12" + "\4\0\1\12\1\0\2\12\7\0\20\12\1\71\12\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\6\12\1\212\24\12" + "\4\0\1\12\1\0\2\12\7\0\7\12\1\275\23\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\1\12\1\224\31\12" + "\4\0\1\12\1\0\2\12\7\0\3\12\1\276\27\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\7\12\1\206\23\12" + "\4\0\1\12\1\0\2\12\7\0\21\12\1\277\11\12"
|
||||
+ "\4\0\1\224\1\0\2\12\7\0\33\12\4\0\1\12" + "\1\0\2\12\7\0\5\12\1\277\25\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\2\12\1\224\10\12\1\135\17\12" + "\4\0\1\12\1\0\2\12\7\0\1\300\32\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\1\224\32\12\4\0\1\12" + "\1\0\2\12\7\0\1\12\1\301\25\12\1\257\3\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\22\12\1\224\10\12" + "\4\0\1\12\1\0\2\12\7\0\16\12\1\302\14\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\1\255\32\12\4\0" + "\1\12\1\0\2\12\7\0\10\12\1\303\22\12\16\0"
|
||||
+ "\1\20\63\0\1\304\25\0\1\220\64\0\1\305\36\0" + "\1\12\1\0\2\12\7\0\14\12\1\306\14\12\1\307"
|
||||
+ "\1\12\4\0\1\12\1\0\2\12\7\0\5\12\1\310" + "\25\12\4\0\1\12\1\0\2\12\7\0\7\12\1\224"
|
||||
+ "\23\12\4\0\1\12\1\0\2\12\7\0\3\12\1\311" + "\27\12\4\0\1\227\1\0\2\12\7\0\12\12\1\312"
|
||||
+ "\1\12\1\313\16\12\4\0\1\12\1\0\2\12\7\0" + "\1\314\32\12\4\0\1\12\1\0\2\12\7\0\7\12"
|
||||
+ "\1\315\23\12\4\0\1\12\1\0\2\12\7\0\5\12" + "\1\316\25\12\4\0\1\12\1\0\2\12\7\0\6\12"
|
||||
+ "\1\257\24\12\4\0\1\12\1\0\2\12\7\0\21\12" + "\1\317\11\12\4\0\1\12\1\0\2\12\7\0\5\12"
|
||||
+ "\1\317\25\12\4\0\1\12\1\0\2\12\7\0\11\12" + "\1\320\21\12\4\0\1\224\1\0\2\12\7\0\1\224"
|
||||
+ "\32\12\4\0\1\12\1\0\2\12\7\0\6\12\1\202" + "\1\321\23\12\4\0\1\12\1\0\2\12\7\0\6\12"
|
||||
+ "\1\322\10\12\1\275\13\12\4\0\1\12\1\0\1\12" + "\1\323\7\0\15\12\1\323\15\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\3\12\1\324\27\12\4\0\1\12\1\0" + "\2\12\7\0\10\12\1\325\22\12\4\0\1\12\1\0"
|
||||
+ "\2\12\7\0\5\12\1\202\11\12\1\224\13\12\4\0" + "\1\12\1\0\2\12\7\0\6\12\1\321\24\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\3\12\1\255\27\12\4\0" + "\1\12\1\0\2\12\7\0\1\326\32\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\3\12\1\327\27\12\4\0\1\12" + "\1\0\2\12\7\0\11\12\1\330\21\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\21\12\1\224\11\12\4\0\1\12" + "\1\0\2\12\7\0\2\12\1\113\30\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\2\12\1\224\30\12\4\0\1\12" + "\1\0\2\12\7\0\6\12\1\331\24\12\4\0\1\12"
|
||||
+ "\1\0\1\12\1\332\7\0\15\12\1\332\15\12\4\0" + "\1\12\1\0\2\12\7\0\2\12\1\333\30\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\26\12\1\224\2\12\1\224" + "\1\12\4\0\1\12\1\0\2\12\7\0\11\12\1\334"
|
||||
+ "\21\12\4\0\1\12\1\0\2\12\7\0\23\12\1\335" + "\7\12\4\0\1\12\1\0\2\12\7\0\1\12\1\135"
|
||||
+ "\31\12\4\0\1\12\1\0\2\12\7\0\10\12\1\135" + "\22\12\4\0\1\12\1\0\2\12\7\0\31\12\1\307"
|
||||
+ "\1\12\4\0\1\12\1\0\2\12\7\0\1\336\32\12" + "\4\0\1\12\1\0\2\12\7\0\11\12\1\337\21\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\6\12\1\202\24\12" + "\4\0\1\12\1\0\2\12\7\0\5\12\1\340\25\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\31\12\1\224\1\12" + "\4\0\1\12\1\0\2\12\7\0\14\12\1\341\16\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\6\12\1\342\5\12" + "\1\343\16\12\4\0\1\12\1\0\2\12\7\0\1\251"
|
||||
+ "\32\12\4\0\1\12\1\0\2\12\7\0\6\12\1\344" + "\24\12\22\0\1\345\61\0\1\304\23\0\1\12\1\0"
|
||||
+ "\1\12\1\200\7\0\15\12\1\200\15\12\4\0\1\12" + "\1\0\2\12\7\0\26\12\1\224\4\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\13\12\1\346\17\12\4\0\1\12" + "\1\0\2\12\7\0\14\12\1\313\10\12\1\347\5\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\14\12\1\71\16\12" + "\4\0\1\12\1\0\2\12\7\0\12\12\1\224\20\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\14\12\1\350\16\12" + "\4\0\1\12\1\0\1\12\1\351\7\0\15\12\1\351"
|
||||
+ "\15\12\4\0\1\12\1\0\2\12\7\0\32\12\1\224" + "\4\0\1\12\1\0\2\12\7\0\10\12\1\113\22\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\10\12\1\224\22\12" + "\4\0\1\12\1\0\2\12\7\0\1\212\32\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\1\12\1\352\31\12\4\0" + "\1\12\1\0\1\12\1\202\7\0\15\12\1\202\15\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\7\12\1\353\23\12" + "\4\0\1\12\1\0\2\12\7\0\11\12\1\354\21\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\2\12\1\355\30\12" + "\4\0\1\12\1\0\2\12\7\0\14\12\1\270\16\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\17\12\1\356\13\12" + "\4\0\1\12\1\0\2\12\7\0\14\12\1\340\16\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\10\12\1\357\22\12" + "\4\0\1\12\1\0\2\12\7\0\1\360\32\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\13\12\1\361\17\12\4\0" + "\1\12\1\0\2\12\7\0\7\12\1\362\23\12\4\0"
|
||||
+ "\1\12\1\0\2\12\7\0\1\202\32\12\4\0\1\12" + "\1\0\2\12\7\0\13\12\1\352\17\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\5\12\1\257\25\12\4\0\1\12" + "\1\0\2\12\7\0\14\12\1\363\16\12\4\0\1\12"
|
||||
+ "\1\0\2\12\7\0\5\12\1\364\25\12\4\0\1\12" + "\1\0\1\12\1\365\7\0\15\12\1\365\15\12\16\0"
|
||||
+ "\1\366\37\0\1\12\1\0\2\12\7\0\12\12\1\355" + "\20\12\4\0\1\12\1\0\2\12\7\0\22\12\1\367"
|
||||
+ "\10\12\4\0\1\12\1\0\1\12\1\370\7\0\15\12" + "\1\370\15\12\4\0\1\12\1\0\2\12\7\0\6\12"
|
||||
+ "\1\371\24\12\4\0\1\12\1\0\2\12\7\0\14\12" + "\1\372\16\12\4\0\1\12\1\0\2\12\7\0\11\12"
|
||||
+ "\1\373\21\12\4\0\1\135\1\0\2\12\7\0\33\12" + "\4\0\1\12\1\0\2\12\7\0\3\12\1\321\27\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\3\12\1\365\27\12" + "\4\0\1\12\1\0\2\12\7\0\6\12\1\170\24\12"
|
||||
+ "\4\0\1\12\1\0\2\12\7\0\3\12\1\224\3\12" + "\1\224\23\12\4\0\1\12\1\0\2\12\7\0\16\12"
|
||||
+ "\1\374\14\12\4\0\1\12\1\0\1\12\1\375\7\0" + "\15\12\1\375\15\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\5\12\1\133\25\12\4\0\1\12\1\0\2\12\7\0" + "\11\12\1\135\21\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\1\12\1\355\31\12\4\0\1\12\1\0\2\12\7\0" + "\3\12\1\270\27\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\14\12\1\202\16\12\4\0\1\12\1\0\2\12\7\0" + "\1\12\1\376\31\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\7\12\1\113\23\12\4\0\1\12\1\0\2\12\7\0" + "\1\12\1\377\31\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\6\12\1\u0100\24\12\4\0\1\12\1\0\2\12\7\0" + "\6\12\1\267\24\12\4\0\1\12\1\0\2\12\7\0"
|
||||
+ "\3\12\1\u0101\2\12\1\177\24\12\4\0\1\12\1\0" + "\2\12\7\0\14\12\1\124\16\12\4\0\1\12\1\0"
|
||||
+ "\1\12\1\135\7\0\15\12\1\135\15\12";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[10038];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\2\1\2\11\1\1\1\11\1\1\1\11\2\1"
|
||||
+ "\2\11\2\1\1\11\25\1\2\11\1\1\2\11\30\1" + "\7\0\106\1\4\0\60\1\2\0\37\1\1\0\20\1" + "\1\11\13\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[257];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. We must have this here as there is no default, no-parameter
|
||||
* constructor generated by JFlex.
|
||||
*/
|
||||
public FortranTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "!", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public FortranTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public FortranTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 168) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 15: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 13: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 5: { // Since we change zzStartRead, we have the
|
||||
// unfortunate
|
||||
// side-effect of not being able to use the '^'
|
||||
// operator.
|
||||
// So we must check whether we're really at the
|
||||
// beginning
|
||||
// of the line ourselves...
|
||||
if (zzStartRead == s.offset) {
|
||||
addToken(zzStartRead, zzEndRead, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
} else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 16: {
|
||||
addToken(Token.LITERAL_BOOLEAN);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 8: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(STRING);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(zzStartRead, zzEndRead, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 6: { // Since we change zzStartRead, we have the
|
||||
// unfortunate
|
||||
// side-effect of not being able to use the '^'
|
||||
// operator.
|
||||
// So we must check whether we're really at the
|
||||
// beginning
|
||||
// of the line ourselves...
|
||||
if (zzStartRead == s.offset) {
|
||||
addToken(zzStartRead, zzEndRead, Token.COMMENT_DOCUMENTATION);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
} else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 9: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(CHAR);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 14: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead, Token.LITERAL_CHAR);
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 12: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 3: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 1: {
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case STRING: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 258:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 259:
|
||||
break;
|
||||
case CHAR: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
case 260:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,930 +0,0 @@
|
||||
/*
|
||||
* 09/28/2007
|
||||
*
|
||||
* GroovyTokenMaker.java - Scanner for the Groovy programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Groovy programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>GroovyTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class GroovyTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public GroovyTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = MULTILINE_STRING_DOUBLE;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = MULTILINE_STRING_SINGLE;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_DOCUMENTATION:
|
||||
state = DOCCOMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether a regular expression token can follow the specified
|
||||
* token.
|
||||
*
|
||||
* @param t The token to check, which may be <code>null</code>.
|
||||
* @return Whether a regular expression token may follow this one.
|
||||
*/
|
||||
private static final boolean regexCanFollow(Token t) {
|
||||
char ch;
|
||||
return t==null ||
|
||||
//t.isOperator() ||
|
||||
(t.length()==1 && (
|
||||
(ch=t.charAt(0))=='=' ||
|
||||
ch=='(' ||
|
||||
ch==',' ||
|
||||
ch=='?' ||
|
||||
ch==':' ||
|
||||
ch=='['
|
||||
)) ||
|
||||
/* Operators "==", "===", "!=", "!==", etc. */
|
||||
(t.getType()==Token.OPERATOR &&
|
||||
((ch=t.charAt(t.length()-1))=='=' || ch=='~'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = [1-9]
|
||||
BinaryDigit = ([0-1])
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
AnyCharacterButApostropheOrBackSlash = ([^\\'])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
CharLiteral = ([\']({AnyCharacterButApostropheOrBackSlash}|{Escape})*[\'])
|
||||
UnclosedCharLiteral = ([\'][^\'\n]*)
|
||||
ErrorCharLiteral = ({UnclosedCharLiteral}[\'])
|
||||
|
||||
MLCBegin = "/*"
|
||||
MLCEnd = "*/"
|
||||
DocCommentBegin = "/**"
|
||||
LineCommentBegin = "//"
|
||||
|
||||
DigitOrUnderscore = ({Digit}|[_])
|
||||
DigitsAndUnderscoresEnd = ({DigitOrUnderscore}*{Digit})
|
||||
IntegerHelper = (({NonzeroDigit}{DigitsAndUnderscoresEnd}?)|"0")
|
||||
IntegerLiteral = ({IntegerHelper}[lL]?)
|
||||
|
||||
BinaryDigitOrUnderscore = ({BinaryDigit}|[_])
|
||||
BinaryDigitsAndUnderscores = ({BinaryDigit}({BinaryDigitOrUnderscore}*{BinaryDigit})?)
|
||||
BinaryLiteral = ("0"[bB]{BinaryDigitsAndUnderscores})
|
||||
|
||||
HexDigitOrUnderscore = ({HexDigit}|[_])
|
||||
HexDigitsAndUnderscores = ({HexDigit}({HexDigitOrUnderscore}*{HexDigit})?)
|
||||
OctalDigitOrUnderscore = ({OctalDigit}|[_])
|
||||
OctalDigitsAndUnderscoresEnd= ({OctalDigitOrUnderscore}*{OctalDigit})
|
||||
HexHelper = ("0"(([xX]{HexDigitsAndUnderscores})|({OctalDigitsAndUnderscoresEnd})))
|
||||
HexLiteral = ({HexHelper}[lL]?)
|
||||
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
BooleanLiteral = ("true"|"false")
|
||||
Regex = ([~]?"/"([^\*\\/]|\\.)([^/\\]|\\.)*"/")
|
||||
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
GroovyOperator = ("=~")
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator}|{GroovyOperator})
|
||||
|
||||
CurrentBlockTag = ("author"|"deprecated"|"exception"|"param"|"return"|"see"|"serial"|"serialData"|"serialField"|"since"|"throws"|"version")
|
||||
ProposedBlockTag = ("category"|"example"|"tutorial"|"index"|"exclude"|"todo"|"internal"|"obsolete"|"threadsafety")
|
||||
BlockTag = ({CurrentBlockTag}|{ProposedBlockTag})
|
||||
InlineTag = ("code"|"docRoot"|"inheritDoc"|"link"|"linkplain"|"literal"|"value")
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
// Variables in strings
|
||||
VariableStart = ([\$])
|
||||
BracedVariable = ({VariableStart}\{[^\}]+\})
|
||||
UnbracedVariable = ({VariableStart}{Identifier})
|
||||
Variable = ({BracedVariable}|{UnbracedVariable})
|
||||
|
||||
Annotation = ("@"{Identifier}?)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state MLC
|
||||
%state DOCCOMMENT
|
||||
%state EOL_COMMENT
|
||||
%state MULTILINE_STRING_DOUBLE
|
||||
%state MULTILINE_STRING_SINGLE
|
||||
%state STRING_DOUBLE
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"abstract" |
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"const" |
|
||||
"continue" |
|
||||
"default" |
|
||||
"do" |
|
||||
"else" |
|
||||
"enum" |
|
||||
"extends" |
|
||||
"final" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"goto" |
|
||||
"if" |
|
||||
"it" |
|
||||
"implements" |
|
||||
"import" |
|
||||
"instanceof" |
|
||||
"interface" |
|
||||
"native" |
|
||||
"new" |
|
||||
"null" |
|
||||
"package" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"static" |
|
||||
"strictfp" |
|
||||
"super" |
|
||||
"switch" |
|
||||
"synchronized" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"throws" |
|
||||
"transient" |
|
||||
"try" |
|
||||
"void" |
|
||||
"volatile" |
|
||||
"while" { addToken(Token.RESERVED_WORD); }
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
/* Groovy keywords */
|
||||
"as" |
|
||||
"assert" |
|
||||
"def" |
|
||||
"mixin" |
|
||||
"property" |
|
||||
"test" |
|
||||
"using" |
|
||||
"in" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Data types. */
|
||||
"boolean" |
|
||||
"byte" |
|
||||
"char" |
|
||||
"double" |
|
||||
"float" |
|
||||
"int" |
|
||||
"long" |
|
||||
"short" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Booleans. */
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
/* java.lang classes */
|
||||
"Appendable" |
|
||||
"AutoCloseable" |
|
||||
"CharSequence" |
|
||||
"Cloneable" |
|
||||
"Comparable" |
|
||||
"Iterable" |
|
||||
"Readable" |
|
||||
"Runnable" |
|
||||
"Thread.UncaughtExceptionHandler" |
|
||||
"Boolean" |
|
||||
"Byte" |
|
||||
"Character" |
|
||||
"Character.Subset" |
|
||||
"Character.UnicodeBlock" |
|
||||
"Class" |
|
||||
"ClassLoader" |
|
||||
"ClassValue" |
|
||||
"Compiler" |
|
||||
"Double" |
|
||||
"Enum" |
|
||||
"Float" |
|
||||
"InheritableThreadLocal" |
|
||||
"Integer" |
|
||||
"Long" |
|
||||
"Math" |
|
||||
"Number" |
|
||||
"Object" |
|
||||
"Package" |
|
||||
"Process" |
|
||||
"ProcessBuilder" |
|
||||
"ProcessBuilder.Redirect" |
|
||||
"Runtime" |
|
||||
"RuntimePermission" |
|
||||
"SecurityManager" |
|
||||
"Short" |
|
||||
"StackTraceElement" |
|
||||
"StrictMath" |
|
||||
"String" |
|
||||
"StringBuffer" |
|
||||
"StringBuilder" |
|
||||
"System" |
|
||||
"Thread" |
|
||||
"ThreadGroup" |
|
||||
"ThreadLocal" |
|
||||
"Throwable" |
|
||||
"Void" |
|
||||
"Character.UnicodeScript" |
|
||||
"ProcessBuilder.Redirect.Type" |
|
||||
"Thread.State" |
|
||||
"ArithmeticException" |
|
||||
"ArrayIndexOutOfBoundsException" |
|
||||
"ArrayStoreException" |
|
||||
"ClassCastException" |
|
||||
"ClassNotFoundException" |
|
||||
"CloneNotSupportedException" |
|
||||
"EnumConstantNotPresentException" |
|
||||
"Exception" |
|
||||
"IllegalAccessException" |
|
||||
"IllegalArgumentException" |
|
||||
"IllegalMonitorStateException" |
|
||||
"IllegalStateException" |
|
||||
"IllegalThreadStateException" |
|
||||
"IndexOutOfBoundsException" |
|
||||
"InstantiationException" |
|
||||
"InterruptedException" |
|
||||
"NegativeArraySizeException" |
|
||||
"NoSuchFieldException" |
|
||||
"NoSuchMethodException" |
|
||||
"NullPointerException" |
|
||||
"NumberFormatException" |
|
||||
"RuntimeException" |
|
||||
"SecurityException" |
|
||||
"StringIndexOutOfBoundsException" |
|
||||
"TypeNotPresentException" |
|
||||
"UnsupportedOperationException" |
|
||||
"AbstractMethodError" |
|
||||
"AssertionError" |
|
||||
"BootstrapMethodError" |
|
||||
"ClassCircularityError" |
|
||||
"ClassFormatError" |
|
||||
"Error" |
|
||||
"ExceptionInInitializerError" |
|
||||
"IllegalAccessError" |
|
||||
"IncompatibleClassChangeError" |
|
||||
"InstantiationError" |
|
||||
"InternalError" |
|
||||
"LinkageError" |
|
||||
"NoClassDefFoundError" |
|
||||
"NoSuchFieldError" |
|
||||
"NoSuchMethodError" |
|
||||
"OutOfMemoryError" |
|
||||
"StackOverflowError" |
|
||||
"ThreadDeath" |
|
||||
"UnknownError" |
|
||||
"UnsatisfiedLinkError" |
|
||||
"UnsupportedClassVersionError" |
|
||||
"VerifyError" |
|
||||
"VirtualMachineError" |
|
||||
|
||||
/* java.io classes*/
|
||||
"Closeable" |
|
||||
"DataInput" |
|
||||
"DataOutput" |
|
||||
"Externalizable" |
|
||||
"FileFilter" |
|
||||
"FilenameFilter" |
|
||||
"Flushable" |
|
||||
"ObjectInput" |
|
||||
"ObjectInputValidation" |
|
||||
"ObjectOutput" |
|
||||
"ObjectStreamConstants" |
|
||||
"Serializable" |
|
||||
|
||||
"BufferedInputStream" |
|
||||
"BufferedOutputStream" |
|
||||
"BufferedReader" |
|
||||
"BufferedWriter" |
|
||||
"ByteArrayInputStream" |
|
||||
"ByteArrayOutputStream" |
|
||||
"CharArrayReader" |
|
||||
"CharArrayWriter" |
|
||||
"Console" |
|
||||
"DataInputStream" |
|
||||
"DataOutputStream" |
|
||||
"File" |
|
||||
"FileDescriptor" |
|
||||
"FileInputStream" |
|
||||
"FileOutputStream" |
|
||||
"FilePermission" |
|
||||
"FileReader" |
|
||||
"FileWriter" |
|
||||
"FilterInputStream" |
|
||||
"FilterOutputStream" |
|
||||
"FilterReader" |
|
||||
"FilterWriter" |
|
||||
"InputStream" |
|
||||
"InputStreamReader" |
|
||||
"LineNumberInputStream" |
|
||||
"LineNumberReader" |
|
||||
"ObjectInputStream" |
|
||||
"ObjectInputStream.GetField" |
|
||||
"ObjectOutputStream" |
|
||||
"ObjectOutputStream.PutField" |
|
||||
"ObjectStreamClass" |
|
||||
"ObjectStreamField" |
|
||||
"OutputStream" |
|
||||
"OutputStreamWriter" |
|
||||
"PipedInputStream" |
|
||||
"PipedOutputStream" |
|
||||
"PipedReader" |
|
||||
"PipedWriter" |
|
||||
"PrintStream" |
|
||||
"PrintWriter" |
|
||||
"PushbackInputStream" |
|
||||
"PushbackReader" |
|
||||
"RandomAccessFile" |
|
||||
"Reader" |
|
||||
"SequenceInputStream" |
|
||||
"SerializablePermission" |
|
||||
"StreamTokenizer" |
|
||||
"StringBufferInputStream" |
|
||||
"StringReader" |
|
||||
"StringWriter" |
|
||||
"Writer" |
|
||||
|
||||
"CharConversionException" |
|
||||
"EOFException" |
|
||||
"FileNotFoundException" |
|
||||
"InterruptedIOException" |
|
||||
"InvalidClassException" |
|
||||
"InvalidObjectException" |
|
||||
"IOException" |
|
||||
"NotActiveException" |
|
||||
"NotSerializableException" |
|
||||
"ObjectStreamException" |
|
||||
"OptionalDataException" |
|
||||
"StreamCorruptedException" |
|
||||
"SyncFailedException" |
|
||||
"UncheckedIOException" |
|
||||
"UnsupportedEncodingException" |
|
||||
"UTFDataFormatException" |
|
||||
"WriteAbortedException" |
|
||||
|
||||
"IOError" |
|
||||
|
||||
/* java.util classes */
|
||||
"Collection" |
|
||||
"Comparator" |
|
||||
"Deque" |
|
||||
"Enumeration" |
|
||||
"EventListener" |
|
||||
"Formattable" |
|
||||
"Iterator" |
|
||||
"List" |
|
||||
"ListIterator" |
|
||||
"Map" |
|
||||
"Map.Entry" |
|
||||
"NavigableMap" |
|
||||
"NavigableSet" |
|
||||
"Observer" |
|
||||
"PrimitiveIterator" |
|
||||
"PrimitiveIterator.OfDouble" |
|
||||
"PrimitiveIterator.OfInt" |
|
||||
"PrimitiveIterator.OfLong" |
|
||||
"Queue" |
|
||||
"RandomAccess" |
|
||||
"Set" |
|
||||
"SortedMap" |
|
||||
"SortedSet" |
|
||||
"Spliterator" |
|
||||
"Spliterator.OfDouble" |
|
||||
"Spliterator.OfInt" |
|
||||
"Spliterator.OfLong" |
|
||||
"Spliterator.OfPrimitive" |
|
||||
|
||||
"AbstractCollection" |
|
||||
"AbstractList" |
|
||||
"AbstractMap" |
|
||||
"AbstractMap.SimpleEntry" |
|
||||
"AbstractMap.SimpleImmutableEntry" |
|
||||
"AbstractQueue" |
|
||||
"AbstractSequentialList" |
|
||||
"AbstractSet" |
|
||||
"ArrayDeque" |
|
||||
"ArrayList" |
|
||||
"Arrays" |
|
||||
"Base64" |
|
||||
"Base64.Decoder" |
|
||||
"Base64.Encoder" |
|
||||
"BitSet" |
|
||||
"Calendar" |
|
||||
"Calendar.Builder" |
|
||||
"Collections" |
|
||||
"Currency" |
|
||||
"Date" |
|
||||
"Dictionary" |
|
||||
"DoubleSummaryStatistics" |
|
||||
"EnumMap" |
|
||||
"EnumSet" |
|
||||
"EventListenerProxy" |
|
||||
"EventObject" |
|
||||
"FormattableFlags" |
|
||||
"Formatter" |
|
||||
"GregorianCalendar" |
|
||||
"HashMap" |
|
||||
"HashSet" |
|
||||
"Hashtable" |
|
||||
"IdentityHashMap" |
|
||||
"IntSummaryStatistics" |
|
||||
"LinkedHashMap" |
|
||||
"LinkedHashSet" |
|
||||
"LinkedList" |
|
||||
"ListResourceBundle" |
|
||||
"Locale" |
|
||||
"Locale.Builder" |
|
||||
"Locale.LanguageRange" |
|
||||
"LongSummaryStatistics" |
|
||||
"Objects" |
|
||||
"Observable" |
|
||||
"Optional" |
|
||||
"OptionalDouble" |
|
||||
"OptionalInt" |
|
||||
"OptionalLong" |
|
||||
"PriorityQueue" |
|
||||
"Properties" |
|
||||
"PropertyPermission" |
|
||||
"PropertyResourceBundle" |
|
||||
"Random" |
|
||||
"ResourceBundle" |
|
||||
"ResourceBundle.Control" |
|
||||
"Scanner" |
|
||||
"ServiceLoader" |
|
||||
"SimpleTimeZone" |
|
||||
"Spliterators" |
|
||||
"Spliterators.AbstractDoubleSpliterator" |
|
||||
"Spliterators.AbstractIntSpliterator" |
|
||||
"Spliterators.AbstractLongSpliterator" |
|
||||
"Spliterators.AbstractSpliterator" |
|
||||
"SpliteratorRandom" |
|
||||
"Stack" |
|
||||
"StringJoiner" |
|
||||
"StringTokenizer" |
|
||||
"Timer" |
|
||||
"TimerTask" |
|
||||
"TimeZone" |
|
||||
"TreeMap" |
|
||||
"TreeSet" |
|
||||
"UUID" |
|
||||
"Vector" |
|
||||
"WeakHashMap" |
|
||||
|
||||
"Formatter.BigDecimalLayoutForm" |
|
||||
"Locale.Category" |
|
||||
"Locale.FilteringMode" |
|
||||
|
||||
"ConcurrentModificationException" |
|
||||
"DuplicateFormatFlagsException" |
|
||||
"EmptyStackException" |
|
||||
"FormatFlagsConversionMismatchException" |
|
||||
"FormatterClosedException" |
|
||||
"IllegalFormatCodePointException" |
|
||||
"IllegalFormatConversionException" |
|
||||
"IllegalFormatException" |
|
||||
"IllegalFormatFlagsException" |
|
||||
"IllegalFormatPrecisionException" |
|
||||
"IllegalFormatWidthException" |
|
||||
"IllformedLocaleException" |
|
||||
"InputMismatchException" |
|
||||
"InvalidPropertiesFormatException" |
|
||||
"MissingFormatArgumentException" |
|
||||
"MissingFormatWidthException" |
|
||||
"MissingResourceException" |
|
||||
"NoSuchElementException" |
|
||||
"TooManyListenersException" |
|
||||
"UnknownFormatConversionException" |
|
||||
"UnknownFormatFlagsException" |
|
||||
|
||||
"ServiceConfigurationError" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Commonly used methods added to Object class */
|
||||
"addShutdownHook" |
|
||||
"any" |
|
||||
"asBoolean" |
|
||||
"asType" |
|
||||
"collect" |
|
||||
"dump" |
|
||||
"each" |
|
||||
"eachWithIndex" |
|
||||
"every" |
|
||||
"find" |
|
||||
"findAll" |
|
||||
"findIndexOf" |
|
||||
"findIndexValues" |
|
||||
"findLastIndexOf" |
|
||||
"getAt" |
|
||||
"getMetaClass" |
|
||||
"getMetaPropertyValues" |
|
||||
"getProperties" |
|
||||
"grep" |
|
||||
"hasProperty" |
|
||||
"identity" |
|
||||
"inject" |
|
||||
"inspect" |
|
||||
"invokeMethod" |
|
||||
"is" |
|
||||
"isCase" |
|
||||
"iterator" |
|
||||
"metaClass" |
|
||||
"print" |
|
||||
"printf" |
|
||||
"println" |
|
||||
"putAt" |
|
||||
"respondsTo" |
|
||||
"setMetaClass" |
|
||||
"sleep" |
|
||||
"split" |
|
||||
"sprintf" |
|
||||
"toString" |
|
||||
"use" |
|
||||
"with" { addToken(Token.FUNCTION); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* Multiline string literals. */
|
||||
\"\"\" { start = zzMarkedPos-3; yybegin(MULTILINE_STRING_DOUBLE); }
|
||||
\'\'\' { start = zzMarkedPos-3; yybegin(MULTILINE_STRING_SINGLE); }
|
||||
|
||||
|
||||
/* String/Character literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{ErrorCharLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
\" { start = zzMarkedPos-1; yybegin(STRING_DOUBLE); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{DocCommentBegin} { start = zzMarkedPos-3; yybegin(DOCCOMMENT); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
|
||||
/* Regular expressions. */
|
||||
{Regex} {
|
||||
boolean highlightedAsRegex = false;
|
||||
if (zzBuffer[zzStartRead]=='~' || firstToken==null) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
else {
|
||||
// If this is *likely* to be a regex, based on
|
||||
// the previous token, highlight it as such.
|
||||
Token t = firstToken.getLastNonCommentNonWhitespaceToken();
|
||||
if (regexCanFollow(t)) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
}
|
||||
// If it doesn't *appear* to be a regex, highlight it as
|
||||
// individual tokens.
|
||||
if (!highlightedAsRegex) {
|
||||
int temp = zzStartRead + 1;
|
||||
addToken(zzStartRead, zzStartRead, Token.OPERATOR);
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Annotations. */
|
||||
{Annotation} { addToken(Token.ANNOTATION); }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{BinaryLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<DOCCOMMENT> {
|
||||
|
||||
[^hwf\@\{\n\<\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_DOCUMENTATION); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
"@"{BlockTag} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
"@" {}
|
||||
"{@"{InlineTag}[^\}]*"}" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
"{" {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); return firstToken; }
|
||||
"<"[/]?({Letter}[^\>]*)?">" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.PREPROCESSOR); start = zzMarkedPos; }
|
||||
\< {}
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_DOCUMENTATION); }
|
||||
\* {}
|
||||
<<EOF>> { yybegin(YYINITIAL); addToken(start,zzEndRead, Token.COMMENT_DOCUMENTATION); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<MULTILINE_STRING_DOUBLE> {
|
||||
[^\"\\\$\n]* {}
|
||||
\\.? { /* Skip escaped chars, handles case: '\"""'. */ }
|
||||
\"\"\" { yybegin(YYINITIAL); addToken(start,zzStartRead+2, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\" {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<MULTILINE_STRING_SINGLE> {
|
||||
[^\'\\\n]* {}
|
||||
\\.? { /* Skip escaped chars, handles case: "\'''". */ }
|
||||
\'\'\' { yybegin(YYINITIAL); addToken(start,zzStartRead+2, Token.LITERAL_CHAR); }
|
||||
\' {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
}
|
||||
|
||||
<STRING_DOUBLE> {
|
||||
[^\n\\\$\"]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); return firstToken; }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,256 +0,0 @@
|
||||
/*
|
||||
* 10/17/2015
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for hosts files.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>HostsTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class HostsTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Whether or not this is the first token on a line.
|
||||
*/
|
||||
private boolean first;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public HostsTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type == Token.RESERVED_WORD;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
first = true;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Identifier = ([^# \t\n]+)
|
||||
Whitespace = ([ \t]+)
|
||||
LineCommentBegin = "#"
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ([A-Za-z0-9_\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$A-Za-z0-9])
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
{Identifier} {
|
||||
addToken(first ? Token.RESERVED_WORD : Token.IDENTIFIER);
|
||||
first = false;
|
||||
}
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
\n |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,621 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 10/17/15 12:49 AM */
|
||||
/*
|
||||
* 10/17/2015
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for hosts files.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>HostsTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class HostsTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int EOL_COMMENT = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\2\1\1\25\0\1\2\1\4\1\0\1\3\1\6\1\4"
|
||||
+ "\7\4\1\4\1\21\1\5\12\6\1\17\1\4\1\0\1\4\1\0" + "\2\4\32\6\1\4\1\0\1\4\1\0\1\4\1\0\4\6\1\16"
|
||||
+ "\1\13\1\6\1\7\1\14\2\6\1\15\3\6\1\11\2\6\1\12" + "\1\10\2\6\1\20\3\6\3\0\1\4\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\2\0\1\1\1\2\1\3\1\4\1\5\1\6\3\5" + "\12\0\1\7\2\0";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[24];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\22\0\44\0\66\0\110\0\66\0\132\0\66"
|
||||
+ "\0\154\0\176\0\220\0\242\0\264\0\306\0\330\0\352"
|
||||
+ "\0\374\0\u010e\0\u0120\0\u0132\0\u0144\0\u0156\0\u0168\0\u0156";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[24];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\1\5\1\6\16\3\1\7\1\10\5\7"
|
||||
+ "\1\11\3\7\1\12\4\7\1\13\1\7\1\3\3\0" + "\16\3\24\0\1\5\17\0\1\7\1\0\5\7\1\0"
|
||||
+ "\3\7\1\0\4\7\1\0\1\7\10\0\1\14\21\0" + "\1\15\3\0\1\16\25\0\1\17\11\0\1\20\22\0"
|
||||
+ "\1\21\25\0\1\22\24\0\1\23\12\0\1\24\27\0" + "\1\25\20\0\1\21\24\0\1\26\12\0\1\21\4\0"
|
||||
+ "\1\25\7\0\1\27\17\0\2\30\12\26\1\30\1\26" + "\1\30\5\0\1\26\14\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[378];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\1\1\11\1\1\1\11\1\1\1\11\3\1" + "\12\0\1\1\2\0";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[24];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
/**
|
||||
* Whether or not this is the first token on a line.
|
||||
*/
|
||||
private boolean first;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public HostsTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type == Token.RESERVED_WORD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
first = true;
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public HostsTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public HostsTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 94) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 2: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 8:
|
||||
break;
|
||||
case 7: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 9:
|
||||
break;
|
||||
case 4: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(EOL_COMMENT);
|
||||
}
|
||||
case 10:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 11:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 12:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(first ? Token.RESERVED_WORD : Token.IDENTIFIER);
|
||||
first = false;
|
||||
}
|
||||
case 13:
|
||||
break;
|
||||
case 5: {
|
||||
}
|
||||
case 14:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case EOL_COMMENT: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,500 +0,0 @@
|
||||
/*
|
||||
* 06/30/2013
|
||||
*
|
||||
* HtaccessTokenMaker.java - Token generator for .htaccess files.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for .htaccess files.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>HtaccessTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.7
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class HtaccessTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Type specific to HtaccessTokenMaker denoting a line ending with an
|
||||
* unclosed double-quote attribute.
|
||||
*/
|
||||
public static final int INTERNAL_ATTR_DOUBLE = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Type specific to HtaccessTokenMaker denoting a line ending with an
|
||||
* unclosed single-quote attribute.
|
||||
*/
|
||||
public static final int INTERNAL_ATTR_SINGLE = -2;
|
||||
|
||||
|
||||
/**
|
||||
* Token type specific to HtaccessTokenMaker denoting a line ending with an
|
||||
* unclosed XML tag; thus a new line is beginning still inside of the tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG = -3;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public HtaccessTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns how to transform a line into a line comment.
|
||||
*
|
||||
* @return The line comment start and end text for .htaccess files.
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_ATTR_DOUBLE:
|
||||
state = INATTR_DOUBLE;
|
||||
break;
|
||||
case INTERNAL_ATTR_SINGLE:
|
||||
state = INATTR_SINGLE;
|
||||
break;
|
||||
case INTERNAL_INTAG:
|
||||
state = INTAG;
|
||||
break;
|
||||
default:
|
||||
state = YYINITIAL;
|
||||
}
|
||||
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
NameStartChar = ([\:A-Z_a-z])
|
||||
NameChar = ({NameStartChar}|[\-\.0-9])
|
||||
TagName = ({NameStartChar}{NameChar}*)
|
||||
Whitespace = ([ \t\f]+)
|
||||
Identifier = ([^ \t\n<#]+)
|
||||
InTagIdentifier = ([^ \t\n\"\'=>]+)
|
||||
LineCommentBegin = ("#")
|
||||
|
||||
AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
|
||||
Escape = ("\\".)
|
||||
StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"])
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
NameStartChar = ([\:A-Z_a-z])
|
||||
NameChar = ({NameStartChar}|[\-\.0-9])
|
||||
TagName = ({NameStartChar}{NameChar}*)
|
||||
DirectiveStart = (("<"[/]?){TagName})
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ([A-Za-z_0-9\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$A-Za-z0-9])
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state EOL_COMMENT
|
||||
%state INTAG
|
||||
%state INATTR_DOUBLE
|
||||
%state INATTR_SINGLE
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
|
||||
"<"{TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-1), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(INTAG);
|
||||
}
|
||||
"</"{TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-2), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(INTAG);
|
||||
}
|
||||
|
||||
"AcceptPathInfo" |
|
||||
"Action" |
|
||||
"AddAlt" |
|
||||
"AddAltByEncoding" |
|
||||
"AddAltByType" |
|
||||
"AddCharset" |
|
||||
"AddDefaultCharset" |
|
||||
"AddDescription" |
|
||||
"AddEncoding" |
|
||||
"AddHandler" |
|
||||
"AddIcon" |
|
||||
"AddIconByEncoding" |
|
||||
"AddIconByType" |
|
||||
"AddInputFilter" |
|
||||
"AddLanguage" |
|
||||
"AddOutputFilter" |
|
||||
"AddOutputFilterByType" |
|
||||
"AddType" |
|
||||
"Allow" |
|
||||
"Anonymous" |
|
||||
"Anonymous_Authoritative" |
|
||||
"Anonymous_LogEmail" |
|
||||
"Anonymous_MustGiveEmail" |
|
||||
"Anonymous_NoUserID" |
|
||||
"Anonymous_VerifyEmail" |
|
||||
"AuthAuthoritative" |
|
||||
"AuthBasicAuthoritative" |
|
||||
"AuthBasicProvider" |
|
||||
"AuthDBMAuthoritative" |
|
||||
"AuthDBMGroupFile" |
|
||||
"AuthDBMType" |
|
||||
"AuthDBMUserFile" |
|
||||
"AuthDigestAlgorithm" |
|
||||
"AuthDigestDomain" |
|
||||
"AuthDigestFile" |
|
||||
"AuthDigestGroupFile" |
|
||||
"AuthDigestNonceFormat" |
|
||||
"AuthDigestNonceLifetime" |
|
||||
"AuthDigestQop" |
|
||||
"AuthGroupFile" |
|
||||
"AuthLDAPAuthoritative" |
|
||||
"AuthLDAPBindDN" |
|
||||
"AuthLDAPBindPassword" |
|
||||
"AuthLDAPCompareDNOnServer" |
|
||||
"AuthLDAPDereferenceAliases" |
|
||||
"AuthLDAPEnabled" |
|
||||
"AuthLDAPFrontPageHack" |
|
||||
"AuthLDAPGroupAttribute" |
|
||||
"AuthLDAPGroupAttributeIsDN" |
|
||||
"AuthLDAPRemoteUserIsDN" |
|
||||
"AuthLDAPUrl" |
|
||||
"AuthName" |
|
||||
"AuthType" |
|
||||
"AuthUserFile" |
|
||||
"BrowserMatch" |
|
||||
"BrowserMatchNoCase" |
|
||||
"CGIMapExtension" |
|
||||
"CharsetDefault" |
|
||||
"CharsetOptions" |
|
||||
"CharsetSourceEnc" |
|
||||
"CheckSpelling" |
|
||||
"ContentDigest" |
|
||||
"CookieDomain" |
|
||||
"CookieExpires" |
|
||||
"CookieName" |
|
||||
"CookieStyle" |
|
||||
"CookieTracking" |
|
||||
"DefaultIcon" |
|
||||
"DefaultLanguage" |
|
||||
"DefaultType" |
|
||||
"Deny" |
|
||||
"DirectoryIndex" |
|
||||
"DirectorySlash" |
|
||||
"EnableMMAP" |
|
||||
"EnableSendfile" |
|
||||
"ErrorDocument" |
|
||||
"Example" |
|
||||
"ExpiresActive" |
|
||||
"ExpiresByType" |
|
||||
"ExpiresDefault" |
|
||||
"FileETag" |
|
||||
"ForceLanguagePriority" |
|
||||
"ForceType" |
|
||||
"Header" |
|
||||
"HeaderName" |
|
||||
"ImapBase" |
|
||||
"ImapDefault" |
|
||||
"ImapMenu" |
|
||||
"IndexIgnore" |
|
||||
"IndexOptions" |
|
||||
"IndexOrderDefault" |
|
||||
"ISAPIAppendLogToErrors" |
|
||||
"ISAPIAppendLogToQuery" |
|
||||
"ISAPIFakeAsync" |
|
||||
"ISAPILogNotSupported" |
|
||||
"ISAPIReadAheadBuffer" |
|
||||
"LanguagePriority" |
|
||||
"LimitRequestBody" |
|
||||
"LimitXMLRequestBody" |
|
||||
"MetaDir" |
|
||||
"MetaFiles" |
|
||||
"MetaSuffix" |
|
||||
"MultiviewsMatch" |
|
||||
"Options" |
|
||||
"Order" |
|
||||
"PassEnv" |
|
||||
"ReadmeName" |
|
||||
"Redirect" |
|
||||
"RedirectMatch" |
|
||||
"RedirectPermanent" |
|
||||
"RedirectTemp" |
|
||||
"RemoveCharset" |
|
||||
"RemoveEncoding" |
|
||||
"RemoveHandler" |
|
||||
"RemoveInputFilter" |
|
||||
"RemoveLanguage" |
|
||||
"RemoveOutputFilter" |
|
||||
"RemoveType" |
|
||||
"RequestHeader" |
|
||||
"Require" |
|
||||
"RewriteBase" |
|
||||
"RewriteCond" |
|
||||
"RewriteEngine" |
|
||||
"RewriteOptions" |
|
||||
"RewriteRule" |
|
||||
"RLimitCPU" |
|
||||
"RLimitMEM" |
|
||||
"RLimitNPROC" |
|
||||
"Satisfy" |
|
||||
"ScriptInterpreterSource" |
|
||||
"ServerSignature" |
|
||||
"SetEnv" |
|
||||
"SetEnvIf" |
|
||||
"SetEnvIfNoCase" |
|
||||
"SetHandler" |
|
||||
"SetInputFilter" |
|
||||
"SetOutputFilter" |
|
||||
"SSIErrorMsg" |
|
||||
"SSITimeFormat" |
|
||||
"SSLCipherSuite" |
|
||||
"SSLOptions" |
|
||||
"SSLProxyCipherSuite" |
|
||||
"SSLProxyVerify" |
|
||||
"SSLProxyVerifyDepth" |
|
||||
"SSLRequire" |
|
||||
"SSLRequireSSL" |
|
||||
"SSLUserName" |
|
||||
"SSLVerifyClient" |
|
||||
"SSLVerifyDepth" |
|
||||
"UnsetEnv" |
|
||||
"XBitHack" { addToken(Token.FUNCTION); }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
\n |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG> {
|
||||
{InTagIdentifier} { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
">" { yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
[\"] { start = zzMarkedPos-1; yybegin(INATTR_DOUBLE); }
|
||||
[\'] { start = zzMarkedPos-1; yybegin(INATTR_SINGLE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, INTERNAL_INTAG); return firstToken; }
|
||||
}
|
||||
|
||||
<INATTR_DOUBLE> {
|
||||
[^\"]* {}
|
||||
[\"] { yybegin(INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE); return firstToken; }
|
||||
}
|
||||
|
||||
<INATTR_SINGLE> {
|
||||
[^\']* {}
|
||||
[\'] { yybegin(INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE); return firstToken; }
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,225 +0,0 @@
|
||||
/*
|
||||
* 11/04/2016
|
||||
*
|
||||
* IniTokenMaker.java - Scanner for .ini files.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class splits up text into tokens representing a .ini file.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>IniTokenMaker.java</code> file will
|
||||
* contain two definitions of both <code>zzRefill</code> and
|
||||
* <code>yyreset</code>. You should hand-delete the second of each
|
||||
* definition (the ones generated by the lexer), as these generated
|
||||
* methods modify the input buffer, which we'll never have to do.
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class IniTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public IniTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { ";", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Equals = ([=])
|
||||
Identifier = ([^ \t\n#;\[=]*)
|
||||
Whitespace = ([ \t]+)
|
||||
Comment = ([#;].*)
|
||||
Section = ([\[][^\]]*[\]]?)
|
||||
|
||||
%state VALUE
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
{Identifier} { addToken(Token.DATA_TYPE); }
|
||||
{Equals} { start = zzMarkedPos; addToken(Token.OPERATOR); yybegin(VALUE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{Comment} { addToken(Token.COMMENT_EOL); }
|
||||
{Section} { addToken(Token.PREPROCESSOR); }
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<VALUE> {
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Equals} { start = zzMarkedPos; addToken(Token.OPERATOR); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{Comment} { addToken(Token.COMMENT_EOL); }
|
||||
{Section} { addToken(Token.PREPROCESSOR); }
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,589 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 11/4/16 11:29 PM */
|
||||
/*
|
||||
* 11/04/2016
|
||||
* IniTokenMaker.java - Scanner for .ini files.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* This class splits up text into tokens representing a .ini file.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>IniTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
public class IniTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int VALUE = 1;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\3\1\5\25\0\1\3\2\0\1\4\27\0\1\4\1\0"
|
||||
+ "\1\1\35\0\1\2\1\0\1\6\uffa2\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\1\1\1\2\1\1\1\3\1\4\1\5\1\6\1\2" + "\1\7\1\4";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[10];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\7\0\16\0\25\0\34\0\43\0\52\0\61" + "\0\25\0\25";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[10];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\1\5\1\6\1\7\1\0\1\3\1\10"
|
||||
+ "\1\11\1\5\1\6\1\7\1\0\1\10\1\3\5\0" + "\1\3\7\0\6\5\1\12\3\0\1\6\3\0\5\7" + "\1\0\1\7\1\10\5\0\1\10";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[56];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\3\1\1\11\4\1\2\11";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[10];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public IniTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { ";", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public IniTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public IniTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 32) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 3: {
|
||||
start = zzMarkedPos;
|
||||
addToken(Token.OPERATOR);
|
||||
yybegin(VALUE);
|
||||
}
|
||||
case 8:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 9:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 10:
|
||||
break;
|
||||
case 7: {
|
||||
start = zzMarkedPos;
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 11:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
}
|
||||
case 12:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.PREPROCESSOR);
|
||||
}
|
||||
case 13:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.DATA_TYPE);
|
||||
}
|
||||
case 14:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 11:
|
||||
break;
|
||||
case VALUE: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 12:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,990 +0,0 @@
|
||||
/*
|
||||
* 02/05/2012
|
||||
*
|
||||
* JavaScriptTokenMaker.java - Parses a document into JavaScript tokens.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for JavaScript files. Its states could be simplified, but are
|
||||
* kept the way they are to keep a degree of similarity (i.e. copy/paste)
|
||||
* between it and HTML/JSP/PHPTokenMaker. This should cause no difference in
|
||||
* performance.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>JavaScriptTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.9
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class JavaScriptTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a JavaScript multiline comment.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_MLC = -8;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a JavaScript documentation comment.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_COMMENT_DOCUMENTATION = -9;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line JS string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_STRING_INVALID = -10;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line JS string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_STRING_VALID = -11;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line JS single-quoted string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_CHAR_INVALID = -12;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line JS single-quoted string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_CHAR_VALID = -13;
|
||||
|
||||
private static final int INTERNAL_E4X = -14;
|
||||
|
||||
private static final int INTERNAL_E4X_INTAG = -15;
|
||||
|
||||
private static final int INTERNAL_E4X_MARKUP_PROCESSING_INSTRUCTION = -16;
|
||||
|
||||
private static final int INTERNAL_IN_E4X_COMMENT = -17;
|
||||
|
||||
private static final int INTERNAL_E4X_DTD = -18;
|
||||
|
||||
private static final int INTERNAL_E4X_DTD_INTERNAL = -19;
|
||||
|
||||
private static final int INTERNAL_E4X_ATTR_SINGLE = -20;
|
||||
|
||||
private static final int INTERNAL_E4X_ATTR_DOUBLE = -21;
|
||||
|
||||
private static final int INTERNAL_E4X_MARKUP_CDATA = -22;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line template literal.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID = -23;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line template literal.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID = -24;
|
||||
|
||||
/**
|
||||
* When in the JS_STRING state, whether the current string is valid.
|
||||
*/
|
||||
private boolean validJSString;
|
||||
|
||||
/**
|
||||
* Whether we're in an internal DTD. Only valid if in an e4x DTD.
|
||||
*/
|
||||
private boolean e4x_inInternalDtd;
|
||||
|
||||
/**
|
||||
* The previous e4x state. Only valid if in an e4x state.
|
||||
*/
|
||||
private int e4x_prevState;
|
||||
|
||||
/**
|
||||
* The version of JavaScript being highlighted.
|
||||
*/
|
||||
private static String jsVersion;
|
||||
|
||||
/**
|
||||
* Whether e4x is being highlighted.
|
||||
*/
|
||||
private static boolean e4xSupported;
|
||||
|
||||
/**
|
||||
* Language state set on JS tokens. Must be 0.
|
||||
*/
|
||||
private static final int LANG_INDEX_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* Language state set on E4X tokens.
|
||||
*/
|
||||
private static final int LANG_INDEX_E4X = 1;
|
||||
|
||||
private Stack<Boolean> varDepths;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public JavaScriptTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
jsVersion = "1.7"; // Many folks using JS tend to be bleeding edge
|
||||
e4xSupported = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the closest {@link TokenTypes} "standard" token type for a given
|
||||
* "internal" token type (e.g. one whose value is <code>< 0</code>).
|
||||
*/
|
||||
@Override
|
||||
public int getClosestStandardTokenTypeForInternalType(int type) {
|
||||
switch (type) {
|
||||
case INTERNAL_IN_JS_MLC:
|
||||
return TokenTypes.COMMENT_MULTILINE;
|
||||
case INTERNAL_IN_JS_COMMENT_DOCUMENTATION:
|
||||
return TokenTypes.COMMENT_DOCUMENTATION;
|
||||
case INTERNAL_IN_JS_STRING_INVALID:
|
||||
case INTERNAL_IN_JS_STRING_VALID:
|
||||
case INTERNAL_IN_JS_CHAR_INVALID:
|
||||
case INTERNAL_IN_JS_CHAR_VALID:
|
||||
return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID:
|
||||
return TokenTypes.LITERAL_BACKQUOTE;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID:
|
||||
return TokenTypes.ERROR_STRING_DOUBLE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the JavaScript version being highlighted.
|
||||
*
|
||||
* @return Supported JavaScript version.
|
||||
* @see #isJavaScriptCompatible(String)
|
||||
*/
|
||||
public static String getJavaScriptVersion() {
|
||||
return jsVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
validJSString = true;
|
||||
e4x_prevState = YYINITIAL;
|
||||
e4x_inInternalDtd = false;
|
||||
int languageIndex = LANG_INDEX_DEFAULT;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_IN_JS_MLC:
|
||||
state = JS_MLC;
|
||||
break;
|
||||
case INTERNAL_IN_JS_COMMENT_DOCUMENTATION:
|
||||
state = JS_DOCCOMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_IN_JS_STRING_INVALID:
|
||||
state = JS_STRING;
|
||||
validJSString = false;
|
||||
break;
|
||||
case INTERNAL_IN_JS_STRING_VALID:
|
||||
state = JS_STRING;
|
||||
break;
|
||||
case INTERNAL_IN_JS_CHAR_INVALID:
|
||||
state = JS_CHAR;
|
||||
validJSString = false;
|
||||
break;
|
||||
case INTERNAL_IN_JS_CHAR_VALID:
|
||||
state = JS_CHAR;
|
||||
break;
|
||||
case INTERNAL_E4X:
|
||||
state = E4X;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_INTAG:
|
||||
state = E4X_INTAG;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_MARKUP_PROCESSING_INSTRUCTION:
|
||||
state = E4X_PI;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_DTD:
|
||||
state = E4X_DTD;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_DTD_INTERNAL:
|
||||
state = E4X_DTD;
|
||||
e4x_inInternalDtd = true;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_ATTR_SINGLE:
|
||||
state = E4X_INATTR_SINGLE;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_ATTR_DOUBLE:
|
||||
state = E4X_INATTR_DOUBLE;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_MARKUP_CDATA:
|
||||
state = E4X_CDATA;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID:
|
||||
state = JS_TEMPLATE_LITERAL;
|
||||
validJSString = true;
|
||||
break;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID:
|
||||
state = JS_TEMPLATE_LITERAL;
|
||||
validJSString = false;
|
||||
break;
|
||||
default:
|
||||
if (initialTokenType<-1024) { // INTERNAL_IN_E4X_COMMENT - prevState
|
||||
int main = -(-initialTokenType & 0xffffff00);
|
||||
switch (main) {
|
||||
default: // Should never happen
|
||||
case INTERNAL_IN_E4X_COMMENT:
|
||||
state = E4X_COMMENT;
|
||||
break;
|
||||
}
|
||||
e4x_prevState = -initialTokenType&0xff;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
}
|
||||
else { // Shouldn't happen
|
||||
state = Token.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
setLanguageIndex(languageIndex);
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether e4x is being highlighted.
|
||||
*
|
||||
* @return Whether e4x is being highlighted.
|
||||
* @see #setE4xSupported(boolean)
|
||||
*/
|
||||
public static boolean isE4xSupported() {
|
||||
return e4xSupported;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether features for a specific JS version should be honored
|
||||
* while highlighting.
|
||||
*
|
||||
* @param version JavaScript version required
|
||||
* @return Whether the JavaScript version is the same or greater than
|
||||
* version required.
|
||||
*/
|
||||
public static boolean isJavaScriptCompatible(String version) {
|
||||
return jsVersion.compareTo(version) >= 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether e4x should be highlighted. A repaint should be forced on
|
||||
* all <code>RSyntaxTextArea</code>s editing JavaScript if this property
|
||||
* is changed to see the difference.
|
||||
*
|
||||
* @param supported Whether e4x should be highlighted.
|
||||
* @see #isE4xSupported()
|
||||
*/
|
||||
public static void setE4xSupported(boolean supported) {
|
||||
e4xSupported = supported;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the supported JavaScript version because some keywords were
|
||||
* introduced on or after this version.
|
||||
*
|
||||
* @param javaScriptVersion The version of JavaScript to support, such as
|
||||
* "<code>1.5</code>" or "<code>1.6</code>".
|
||||
* @see #isJavaScriptCompatible(String)
|
||||
* @see #getJavaScriptVersion()
|
||||
*/
|
||||
public static void setJavaScriptVersion(String javaScriptVersion) {
|
||||
jsVersion = javaScriptVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Whitespace = ([ \t\f]+)
|
||||
LineTerminator = ([\n])
|
||||
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
LetterOrDigit = ({Letter}|{Digit})
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'\`]|"#"|"\\")
|
||||
IdentifierStart = ({Letter}|"_"|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
JS_MLCBegin = "/*"
|
||||
JS_DocCommentBegin = "/**"
|
||||
JS_MLCEnd = "*/"
|
||||
JS_LineCommentBegin = "//"
|
||||
JS_IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
JS_IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
JS_IntegerLiteral = ({JS_IntegerHelper1}[lL]?)
|
||||
JS_HexLiteral = ({JS_IntegerHelper2}[lL]?)
|
||||
JS_FloatHelper1 = ([fFdD]?)
|
||||
JS_FloatHelper2 = ([eE][+-]?{Digit}+{JS_FloatHelper1})
|
||||
JS_FloatLiteral1 = ({Digit}+"."({JS_FloatHelper1}|{JS_FloatHelper2}|{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2})))
|
||||
JS_FloatLiteral2 = ("."{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2}))
|
||||
JS_FloatLiteral3 = ({Digit}+{JS_FloatHelper2})
|
||||
JS_FloatLiteral = ({JS_FloatLiteral1}|{JS_FloatLiteral2}|{JS_FloatLiteral3}|({Digit}+[fFdD]))
|
||||
JS_ErrorNumberFormat = (({JS_IntegerLiteral}|{JS_HexLiteral}|{JS_FloatLiteral}){NonSeparator}+)
|
||||
JS_Separator = ([\(\)\{\}\[\]\]])
|
||||
JS_Separator2 = ([\;,.])
|
||||
JS_NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"||"|"&&"|">>>")
|
||||
JS_AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
JS_Operator = ({JS_NonAssignmentOperator}|{JS_AssignmentOperator})
|
||||
JS_Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
JS_ErrorIdentifier = ({NonSeparator}+)
|
||||
JS_Regex = ("/"([^\*\\/]|\\.)([^/\\]|\\.)*"/"[gim]*)
|
||||
JS_E4xAttribute = ("@"{Letter}{LetterOrDigit}*)
|
||||
|
||||
JS_BlockTag = ("abstract"|"access"|"alias"|"augments"|"author"|"borrows"|
|
||||
"callback"|"classdesc"|"constant"|"constructor"|"constructs"|
|
||||
"copyright"|"default"|"deprecated"|"desc"|"enum"|"event"|
|
||||
"example"|"exports"|"external"|"file"|"fires"|"global"|
|
||||
"ignore"|"inner"|"instance"|"kind"|"lends"|"license"|
|
||||
"link"|"member"|"memberof"|"method"|"mixes"|"mixin"|"module"|
|
||||
"name"|"namespace"|"param"|"private"|"property"|"protected"|
|
||||
"public"|"readonly"|"requires"|"return"|"returns"|"see"|"since"|
|
||||
"static"|"summary"|"this"|"throws"|"todo"|
|
||||
"type"|"typedef"|"variation"|"version")
|
||||
JS_InlineTag = ("link"|"linkplain"|"linkcode"|"tutorial")
|
||||
JS_TemplateLiteralExprStart = ("${")
|
||||
|
||||
e4x_NameStartChar = ([\:A-Z_a-z])
|
||||
e4x_NameChar = ({e4x_NameStartChar}|[\-\.0-9])
|
||||
e4x_TagName = ({e4x_NameStartChar}{e4x_NameChar}*)
|
||||
e4x_Identifier = ([^ \t\n<&;]+)
|
||||
e4x_EndXml = ([;])
|
||||
e4x_EntityReference = ([&][^; \t]*[;]?)
|
||||
e4x_InTagIdentifier = ([^ \t\n\"\'=\/>]+)
|
||||
e4x_CDataBegin = ("<![CDATA[")
|
||||
e4x_CDataEnd = ("]]>")
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrDigit}|"_"|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{LetterOrDigit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state JS_STRING
|
||||
%state JS_CHAR
|
||||
%state JS_MLC
|
||||
%state JS_DOCCOMMENT
|
||||
%state JS_EOL_COMMENT
|
||||
%state E4X
|
||||
%state E4X_COMMENT
|
||||
%state E4X_PI
|
||||
%state E4X_DTD
|
||||
%state E4X_INTAG
|
||||
%state E4X_INATTR_DOUBLE
|
||||
%state E4X_INATTR_SINGLE
|
||||
%state E4X_CDATA
|
||||
%state JS_TEMPLATE_LITERAL
|
||||
%state JS_TEMPLATE_LITERAL_EXPR
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
// ECMA 3+ keywords.
|
||||
"break" |
|
||||
"continue" |
|
||||
"delete" |
|
||||
"else" |
|
||||
"for" |
|
||||
"function" |
|
||||
"if" |
|
||||
"in" |
|
||||
"new" |
|
||||
"this" |
|
||||
"typeof" |
|
||||
"var" |
|
||||
"void" |
|
||||
"while" |
|
||||
"with" { addToken(Token.RESERVED_WORD); }
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
//e4X
|
||||
"each" {if(e4xSupported){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);} }
|
||||
//JavaScript 1.7
|
||||
"let" {if(isJavaScriptCompatible("1.7")){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);} }
|
||||
// e4x miscellaneous
|
||||
{JS_E4xAttribute} { addToken(isE4xSupported() ? Token.MARKUP_TAG_ATTRIBUTE : Token.ERROR_IDENTIFIER); }
|
||||
|
||||
// Reserved (but not yet used) ECMA keywords.
|
||||
"abstract" { addToken(Token.RESERVED_WORD); }
|
||||
"boolean" { addToken(Token.DATA_TYPE); }
|
||||
"byte" { addToken(Token.DATA_TYPE); }
|
||||
"case" { addToken(Token.RESERVED_WORD); }
|
||||
"catch" { addToken(Token.RESERVED_WORD); }
|
||||
"char" { addToken(Token.DATA_TYPE); }
|
||||
"class" { addToken(Token.RESERVED_WORD); }
|
||||
"const" { addToken(Token.RESERVED_WORD); }
|
||||
"debugger" { addToken(Token.RESERVED_WORD); }
|
||||
"default" { addToken(Token.RESERVED_WORD); }
|
||||
"do" { addToken(Token.RESERVED_WORD); }
|
||||
"double" { addToken(Token.DATA_TYPE); }
|
||||
"enum" { addToken(Token.RESERVED_WORD); }
|
||||
"export" { addToken(Token.RESERVED_WORD); }
|
||||
"extends" { addToken(Token.RESERVED_WORD); }
|
||||
"final" { addToken(Token.RESERVED_WORD); }
|
||||
"finally" { addToken(Token.RESERVED_WORD); }
|
||||
"float" { addToken(Token.DATA_TYPE); }
|
||||
"goto" { addToken(Token.RESERVED_WORD); }
|
||||
"implements" { addToken(Token.RESERVED_WORD); }
|
||||
"import" { addToken(Token.RESERVED_WORD); }
|
||||
"instanceof" { addToken(Token.RESERVED_WORD); }
|
||||
"int" { addToken(Token.DATA_TYPE); }
|
||||
"interface" { addToken(Token.RESERVED_WORD); }
|
||||
"long" { addToken(Token.DATA_TYPE); }
|
||||
"native" { addToken(Token.RESERVED_WORD); }
|
||||
"package" { addToken(Token.RESERVED_WORD); }
|
||||
"private" { addToken(Token.RESERVED_WORD); }
|
||||
"protected" { addToken(Token.RESERVED_WORD); }
|
||||
"public" { addToken(Token.RESERVED_WORD); }
|
||||
"short" { addToken(Token.DATA_TYPE); }
|
||||
"static" { addToken(Token.RESERVED_WORD); }
|
||||
"super" { addToken(Token.RESERVED_WORD); }
|
||||
"switch" { addToken(Token.RESERVED_WORD); }
|
||||
"synchronized" { addToken(Token.RESERVED_WORD); }
|
||||
"throw" { addToken(Token.RESERVED_WORD); }
|
||||
"throws" { addToken(Token.RESERVED_WORD); }
|
||||
"transient" { addToken(Token.RESERVED_WORD); }
|
||||
"try" { addToken(Token.RESERVED_WORD); }
|
||||
"volatile" { addToken(Token.RESERVED_WORD); }
|
||||
"null" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
// Literals.
|
||||
"false" |
|
||||
"true" { addToken(Token.LITERAL_BOOLEAN); }
|
||||
"NaN" { addToken(Token.RESERVED_WORD); }
|
||||
"Infinity" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
// Functions.
|
||||
"eval" |
|
||||
"parseInt" |
|
||||
"parseFloat" |
|
||||
"escape" |
|
||||
"unescape" |
|
||||
"isNaN" |
|
||||
"isFinite" { addToken(Token.FUNCTION); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{JS_Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
[\'] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_CHAR); }
|
||||
[\"] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_STRING); }
|
||||
[\`] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_TEMPLATE_LITERAL); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{JS_MLCBegin} { start = zzMarkedPos-2; yybegin(JS_MLC); }
|
||||
{JS_DocCommentBegin} { start = zzMarkedPos-3; yybegin(JS_DOCCOMMENT); }
|
||||
{JS_LineCommentBegin} { start = zzMarkedPos-2; yybegin(JS_EOL_COMMENT); }
|
||||
|
||||
/* Attempt to identify regular expressions (not foolproof) - do after comments! */
|
||||
{JS_Regex} {
|
||||
boolean highlightedAsRegex = false;
|
||||
if (firstToken==null) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
else {
|
||||
// If this is *likely* to be a regex, based on
|
||||
// the previous token, highlight it as such.
|
||||
Token t = firstToken.getLastNonCommentNonWhitespaceToken();
|
||||
if (RSyntaxUtilities.regexCanFollowInJavaScript(t)) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
}
|
||||
// If it doesn't *appear* to be a regex, highlight it as
|
||||
// individual tokens.
|
||||
if (!highlightedAsRegex) {
|
||||
int temp = zzStartRead + 1;
|
||||
addToken(zzStartRead, zzStartRead, Token.OPERATOR);
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Separators. */
|
||||
{JS_Separator} { addToken(Token.SEPARATOR); }
|
||||
{JS_Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
[\+]?"="{Whitespace}*"<" {
|
||||
int start = zzStartRead;
|
||||
int operatorLen = yycharat(0)=='+' ? 2 : 1;
|
||||
int yylen = yylength(); // Cache before first addToken() invalidates it
|
||||
//System.out.println("'" + yytext() + "': " + yylength() + ", " + (operatorLen+1));
|
||||
addToken(zzStartRead,zzStartRead+operatorLen-1, Token.OPERATOR);
|
||||
if (yylen>operatorLen+1) {
|
||||
//System.out.println((start+operatorLen) + ", " + (zzMarkedPos-2));
|
||||
addToken(start+operatorLen,zzMarkedPos-2, Token.WHITESPACE);
|
||||
}
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos = zzMarkedPos - 1;
|
||||
if (isE4xSupported()) {
|
||||
// Scanning will continue with "<" as markup tag start
|
||||
yybegin(E4X, LANG_INDEX_E4X);
|
||||
}
|
||||
// Found e4x (or syntax error) but option not enabled;
|
||||
// Scanning will continue at "<" as operator
|
||||
}
|
||||
{JS_Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{JS_IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{JS_HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{JS_FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{JS_ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{JS_ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<JS_STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_STRING_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_STRING_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\" { int type = validJSString ? Token.LITERAL_STRING_DOUBLE_QUOTE : Token.ERROR_STRING_DOUBLE; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_CHAR> {
|
||||
[^\n\\\']+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_CHAR);
|
||||
addEndToken(INTERNAL_IN_JS_CHAR_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_CHAR);
|
||||
addEndToken(INTERNAL_IN_JS_CHAR_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\' { int type = validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_TEMPLATE_LITERAL> {
|
||||
[^\n\\\$\`]+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
|
||||
{JS_TemplateLiteralExprStart} {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_BACKQUOTE);
|
||||
start = zzMarkedPos-2;
|
||||
if (varDepths==null) {
|
||||
varDepths = new Stack<Boolean>();
|
||||
}
|
||||
else {
|
||||
varDepths.clear();
|
||||
}
|
||||
varDepths.push(Boolean.TRUE);
|
||||
yybegin(JS_TEMPLATE_LITERAL_EXPR);
|
||||
}
|
||||
"$" { /* Skip valid '$' that is not part of template literal expression start */ }
|
||||
|
||||
\` { int type = validJSString ? Token.LITERAL_BACKQUOTE : Token.ERROR_STRING_DOUBLE; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
|
||||
/* Line ending in '\' => continue to next line, though not necessary in template strings. */
|
||||
\\ {
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_BACKQUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\n |
|
||||
<<EOF>> {
|
||||
if (validJSString) {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_BACKQUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead - 1, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
<JS_TEMPLATE_LITERAL_EXPR> {
|
||||
[^\}\$\n]+ {}
|
||||
"}" {
|
||||
if (!varDepths.empty()) {
|
||||
varDepths.pop();
|
||||
if (varDepths.empty()) {
|
||||
addToken(start,zzStartRead, Token.VARIABLE);
|
||||
start = zzMarkedPos;
|
||||
yybegin(JS_TEMPLATE_LITERAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
{JS_TemplateLiteralExprStart} { varDepths.push(Boolean.TRUE); }
|
||||
"$" {}
|
||||
\n |
|
||||
<<EOF>> {
|
||||
// TODO: This isn't right. The expression and its depth should continue to the next line.
|
||||
addToken(start,zzStartRead-1, Token.VARIABLE); addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID); return firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
<JS_MLC> {
|
||||
// JavaScript MLC's. This state is essentially Java's MLC state.
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
{JS_MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_DOCCOMMENT> {
|
||||
[^hwf\@\{\n\<\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_DOCUMENTATION); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
"@"{JS_BlockTag} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_KEYWORD); start = zzMarkedPos; }
|
||||
"@" {}
|
||||
"{@"{JS_InlineTag}[^\}]*"}" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_KEYWORD); start = zzMarkedPos; }
|
||||
"{" {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addEndToken(INTERNAL_IN_JS_COMMENT_DOCUMENTATION); return firstToken; }
|
||||
"<"[/]?({Letter}[^\>]*)?">" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_MARKUP); start = zzMarkedPos; }
|
||||
\< {}
|
||||
{JS_MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_DOCUMENTATION); }
|
||||
\* {}
|
||||
<<EOF>> { yybegin(YYINITIAL); addToken(start,zzEndRead, Token.COMMENT_DOCUMENTATION); addEndToken(INTERNAL_IN_JS_COMMENT_DOCUMENTATION); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X> {
|
||||
"<!--" { start = zzStartRead; e4x_prevState = zzLexicalState; yybegin(E4X_COMMENT); }
|
||||
{e4x_CDataBegin} { addToken(Token.MARKUP_CDATA_DELIMITER); start = zzMarkedPos; yybegin(E4X_CDATA); }
|
||||
"<!" { start = zzMarkedPos-2; e4x_inInternalDtd = false; yybegin(E4X_DTD); }
|
||||
"<?" { start = zzMarkedPos-2; yybegin(E4X_PI); }
|
||||
"<"{e4x_TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-1), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(E4X_INTAG);
|
||||
}
|
||||
"</"{e4x_TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-2), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(E4X_INTAG);
|
||||
}
|
||||
"<" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(E4X_INTAG); }
|
||||
"</" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(E4X_INTAG); }
|
||||
{e4x_Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{e4x_EndXml} { yybegin(YYINITIAL, LANG_INDEX_DEFAULT); addToken(Token.IDENTIFIER); }
|
||||
{e4x_EntityReference} { addToken(Token.MARKUP_ENTITY_REFERENCE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addEndToken(INTERNAL_E4X); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_COMMENT> {
|
||||
[^hwf\n\-]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addHyperlinkToken(temp,zzMarkedPos-1, Token.MARKUP_COMMENT); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
"-->" { int temp = zzMarkedPos; addToken(start,zzStartRead+2, Token.MARKUP_COMMENT); start = temp; yybegin(e4x_prevState); }
|
||||
"-" {}
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addEndToken(INTERNAL_IN_E4X_COMMENT - e4x_prevState); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_PI> {
|
||||
[^\n\?]+ {}
|
||||
"?>" { yybegin(E4X); addToken(start,zzStartRead+1, Token.MARKUP_PROCESSING_INSTRUCTION); }
|
||||
"?" {}
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_PROCESSING_INSTRUCTION); addEndToken(INTERNAL_E4X_MARKUP_PROCESSING_INSTRUCTION); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_DTD> {
|
||||
[^\n\[\]<>]+ {}
|
||||
"<!--" { int temp = zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_DTD); start = temp; e4x_prevState = zzLexicalState; yybegin(E4X_COMMENT); }
|
||||
"<" {}
|
||||
"[" { e4x_inInternalDtd = true; }
|
||||
"]" { e4x_inInternalDtd = false; }
|
||||
">" { if (!e4x_inInternalDtd) { yybegin(E4X); addToken(start,zzStartRead, Token.MARKUP_DTD); } }
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_DTD); addEndToken(e4x_inInternalDtd ? INTERNAL_E4X_DTD_INTERNAL : INTERNAL_E4X_DTD); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_INTAG> {
|
||||
{e4x_InTagIdentifier} { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
"/" { addToken(Token.MARKUP_TAG_DELIMITER); /* Not valid but we'll still accept it */ }
|
||||
"/>" { yybegin(E4X); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
">" { yybegin(E4X); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
[\"] { start = zzMarkedPos-1; yybegin(E4X_INATTR_DOUBLE); }
|
||||
[\'] { start = zzMarkedPos-1; yybegin(E4X_INATTR_SINGLE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, INTERNAL_E4X_INTAG); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_INATTR_DOUBLE> {
|
||||
[^\"]* {}
|
||||
[\"] { yybegin(E4X_INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_E4X_ATTR_DOUBLE); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_INATTR_SINGLE> {
|
||||
[^\']* {}
|
||||
[\'] { yybegin(E4X_INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_E4X_ATTR_SINGLE); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_CDATA> {
|
||||
[^\]]+ {}
|
||||
{e4x_CDataEnd} { int temp=zzStartRead; yybegin(E4X); addToken(start,zzStartRead-1, Token.MARKUP_CDATA); addToken(temp,zzMarkedPos-1, Token.MARKUP_CDATA_DELIMITER); }
|
||||
"]" {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_CDATA); addEndToken(INTERNAL_E4X_MARKUP_CDATA); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 03/15/2015
|
||||
* JshintrcTokenMaker.java - Scanner for .jshintrc files.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
/**
|
||||
* Scanner for .jshintrc files. This is equivalent to JSON with C-style
|
||||
* end-of-line comments.
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JshintrcTokenMaker extends JsonTokenMaker {
|
||||
|
||||
/**
|
||||
* Constructor; overridden to enable highlighting of EOL comments.
|
||||
*/
|
||||
public JshintrcTokenMaker() {
|
||||
setHighlightEolComments(true);
|
||||
}
|
||||
}
|
||||
@@ -1,316 +0,0 @@
|
||||
/*
|
||||
* 12/23/2012
|
||||
*
|
||||
* JsonTokenMaker.java - Scanner for JSON.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for JSON.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>JsonTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.6
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class JsonTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
private boolean highlightEolComments;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public JsonTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> always as C-style languages use curly braces
|
||||
* to denote code blocks.
|
||||
*
|
||||
* @return <code>true</code> always.
|
||||
*/
|
||||
public boolean getCurlyBracesDenoteCodeBlocks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getShouldIndentNextLineAfter(Token t) {
|
||||
if (t!=null && t.length()==1) {
|
||||
char ch = t.charAt(0);
|
||||
return ch=='{' || ch=='[';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
start = text.offset;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setHighlightEolComments(boolean highlightEolComments) {
|
||||
this.highlightEolComments = highlightEolComments;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Whitespace = ([ \t\f]+)
|
||||
Letter = ([A-Za-z])
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
Digit = ([0-9])
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
IdentifierStart = ([^\" \t\f\[\]\{\}\:,0-9\-/])
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|[\-])
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
|
||||
AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
Escape = ("\\"(([btnfr\"\\/])|{EscapedSourceCharacter}))
|
||||
Key = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"])
|
||||
StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"])
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
IntegerLiteral = ("-"?{Digit}+)
|
||||
FloatLiteral = ({IntegerLiteral}("."({Digit}+))?([eE][+\-]?{Digit}+)?)
|
||||
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\{\}\[\]])
|
||||
Separator2 = ([\:,])
|
||||
|
||||
LineCommentBegin = "//"
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
"null" { addToken(Token.RESERVED_WORD); }
|
||||
{Key}/: { addToken(Token.VARIABLE); }
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
|
||||
{LineCommentBegin} {
|
||||
if (highlightEolComments) {
|
||||
start = zzMarkedPos-2; yybegin(EOL_COMMENT);
|
||||
}
|
||||
else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
"/" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
\n |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as identifiers. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,713 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 8/22/15 3:14 PM */
|
||||
/*
|
||||
* 12/23/2012
|
||||
* JsonTokenMaker.java - Scanner for JSON.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for JSON.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>JsonTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.6
|
||||
*
|
||||
*/
|
||||
public class JsonTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int EOL_COMMENT = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\1\1\10\1\0\1\1\23\0\1\1\1\3\1\11\1\3"
|
||||
+ "\1\2\1\3\5\3\1\21\1\6\1\7\1\17\1\16\12\4\1\32" + "\1\3\1\0\1\3\1\0\2\3\4\5\1\20\1\5\24\2\1\33"
|
||||
+ "\1\13\1\33\1\0\1\3\1\0\1\26\1\15\2\5\1\24\1\25" + "\1\2\1\34\1\36\2\2\1\27\1\2\1\14\1\2\1\35\1\2"
|
||||
+ "\1\23\1\30\1\22\1\12\1\2\1\37\3\2\1\31\1\0\1\31" + "\1\3\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\2\0\1\1\1\2\1\3\2\1\1\4\4\1\1\5"
|
||||
+ "\1\6\1\7\3\6\2\0\1\4\1\10\1\4\1\1" + "\1\11\2\1\4\0\2\12\1\0\1\13\1\4\1\14"
|
||||
+ "\1\4\3\1\4\0\1\4\1\15\1\16\2\0\1\17" + "\1\4\2\0\1\4";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[55];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\40\0\100\0\140\0\200\0\240\0\300\0\340"
|
||||
+ "\0\u0100\0\u0120\0\u0140\0\u0160\0\240\0\u0180\0\240\0\u01a0"
|
||||
+ "\0\u01c0\0\u01e0\0\u0200\0\u0220\0\u0240\0\u0260\0\u0280\0\u02a0"
|
||||
+ "\0\240\0\u02c0\0\u02e0\0\u0300\0\u0320\0\u0340\0\u0360\0\u0380"
|
||||
+ "\0\u03a0\0\u03a0\0\240\0\u03c0\0\240\0\u03e0\0\u0400\0\u0420"
|
||||
+ "\0\u0440\0\u0460\0\u0480\0\u04a0\0\u04c0\0\u04e0\0\100\0\100"
|
||||
+ "\0\u0500\0\u0520\0\u0540\0\u0560\0\u0580\0\u0540\0\u05a0";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[55];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\2\3\1\5\1\3\1\6\1\7\1\3"
|
||||
+ "\1\10\2\3\1\11\1\3\1\12\3\3\1\13\2\3" + "\1\14\3\3\1\15\1\6\1\15\4\3\10\16\1\17"
|
||||
+ "\14\16\1\20\6\16\1\21\2\16\1\22\1\3\1\0" + "\4\3\1\0\2\3\1\0\4\3\1\0\12\3\3\0"
|
||||
+ "\4\3\1\0\1\4\42\0\1\5\12\0\1\23\1\24" + "\3\0\1\24\57\0\1\5\33\0\10\10\1\25\1\26"
|
||||
+ "\1\10\1\27\24\10\1\3\1\0\4\3\1\0\2\3" + "\1\0\1\30\3\3\1\0\12\3\3\0\4\3\16\0"
|
||||
+ "\1\31\21\0\1\3\1\0\4\3\1\0\2\3\1\0" + "\4\3\1\0\4\3\1\32\5\3\3\0\5\3\1\0"
|
||||
+ "\4\3\1\0\2\3\1\0\4\3\1\0\7\3\1\33" + "\2\3\3\0\4\3\10\16\1\0\14\16\1\0\6\16"
|
||||
+ "\1\0\2\16\23\0\1\34\13\0\1\35\23\0\1\36" + "\54\0\1\37\4\0\1\40\37\0\1\41\2\0\1\42"
|
||||
+ "\11\0\1\42\16\0\11\25\1\43\1\25\1\44\24\25" + "\32\0\1\45\5\0\10\25\1\0\1\10\1\46\4\10"
|
||||
+ "\3\25\2\10\1\25\1\10\12\25\1\3\1\0\4\3" + "\1\0\2\3\1\0\4\3\1\0\10\3\1\47\1\3"
|
||||
+ "\3\0\5\3\1\0\4\3\1\0\2\3\1\0\1\50" + "\3\3\1\0\12\3\3\0\5\3\1\0\4\3\1\0"
|
||||
+ "\2\3\1\0\4\3\1\0\10\3\1\51\1\3\3\0" + "\4\3\35\0\1\52\31\0\1\53\32\0\1\54\54\0"
|
||||
+ "\1\55\4\0\1\40\13\0\1\24\3\0\1\24\17\0" + "\1\41\33\0\10\25\1\0\33\25\2\56\3\25\1\43"
|
||||
+ "\1\25\1\44\1\25\1\56\2\25\1\56\3\25\3\56" + "\11\25\1\3\1\0\4\3\1\0\2\3\1\0\4\3"
|
||||
+ "\1\0\10\3\1\57\1\3\3\0\5\3\1\0\4\3" + "\1\0\2\3\1\0\4\3\1\0\5\3\1\60\4\3"
|
||||
+ "\3\0\5\3\1\0\4\3\1\0\2\3\1\0\4\3" + "\1\0\11\3\1\50\3\0\4\3\32\0\1\61\31\0"
|
||||
+ "\1\52\50\0\1\62\21\0\1\63\20\0\4\25\2\64" + "\3\25\1\43\1\25\1\44\1\25\1\64\2\25\1\64"
|
||||
+ "\3\25\3\64\11\25\16\0\1\65\51\0\1\52\1\0" + "\1\61\7\0\1\63\1\66\2\63\2\66\2\0\1\63"
|
||||
+ "\1\0\3\63\1\66\1\63\1\66\7\63\1\0\2\66" + "\4\63\4\25\2\67\3\25\1\43\1\25\1\44\1\25"
|
||||
+ "\1\67\2\25\1\67\3\25\3\67\11\25\16\0\1\63" + "\21\0\4\25\2\10\3\25\1\43\1\25\1\44\1\25"
|
||||
+ "\1\10\2\25\1\10\3\25\3\10\11\25";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[1472];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\3\1\1\11\6\1\1\11\1\1\1\11\3\1"
|
||||
+ "\2\0\1\1\1\3\2\1\1\11\2\1\4\0\2\1" + "\1\0\1\11\1\1\1\15\4\1\4\0\3\1\2\0" + "\2\1\2\0\1\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[55];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the textposition at the last state to be included in yytext */
|
||||
private int zzPushbackPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
private boolean highlightEolComments;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public JsonTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start, end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> always as C-style languages use curly braces to
|
||||
* denote code blocks.
|
||||
*
|
||||
* @return <code>true</code> always.
|
||||
*/
|
||||
public boolean getCurlyBracesDenoteCodeBlocks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShouldIndentNextLineAfter(Token t) {
|
||||
if (t != null && t.length() == 1) {
|
||||
char ch = t.charAt(0);
|
||||
return ch == '{' || ch == '[';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
protected void setHighlightEolComments(boolean highlightEolComments) {
|
||||
this.highlightEolComments = highlightEolComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public JsonTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public JsonTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 124) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
int zzPushbackPosL = zzPushbackPos = -1;
|
||||
boolean zzWasPushback;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzWasPushback = false;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
zzPushbackPos = zzPushbackPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
zzPushbackPosL = zzPushbackPos;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 2) == 2)
|
||||
zzPushbackPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzWasPushback = (zzAttributes & 4) == 4;
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
if (zzWasPushback)
|
||||
zzMarkedPos = zzPushbackPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 13: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 16:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(Token.LITERAL_NUMBER_FLOAT);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 12: {
|
||||
addToken(Token.VARIABLE);
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 9: {
|
||||
if (highlightEolComments) {
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(EOL_COMMENT);
|
||||
} else {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 15: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(Token.LITERAL_BOOLEAN);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.ERROR_STRING_DOUBLE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(Token.ERROR_STRING_DOUBLE);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 6: {
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case EOL_COMMENT: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 56:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 57:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
/*
|
||||
* 04/24/2012
|
||||
*
|
||||
* LatexTokenMaker.java - Scanner for LaTeX.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the LaTeX.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RSTA always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>LatexTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class LatexTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public LatexTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ${inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "%", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
* @exception IOException if any I/O-Error occurs.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = ([A-Za-z])
|
||||
Digit = ([0-9])
|
||||
LetterOrUnderscore = ({Letter}|[_])
|
||||
AnyChar = ({LetterOrUnderscore}|{Digit}|[\-])
|
||||
Whitespace = ([ \t\f])
|
||||
LineCommentBegin = "%"
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
([\\]{AnyChar}+) { addToken(Token.FUNCTION); }
|
||||
([\\]%) { int temp = zzStartRead;
|
||||
addToken(temp, temp, Token.SEPARATOR);
|
||||
addToken(temp + 1, temp + 1, Token.IDENTIFIER);
|
||||
}
|
||||
[\{\}] { addToken(Token.SEPARATOR); }
|
||||
("\\begin{"{AnyChar}+"}") { int temp = zzStartRead;
|
||||
addToken(temp, temp+5, Token.RESERVED_WORD);
|
||||
addToken(temp+6, temp+6, Token.SEPARATOR);
|
||||
addToken(temp+7, zzMarkedPos-2, Token.RESERVED_WORD);
|
||||
addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
|
||||
}
|
||||
("\\end{"{AnyChar}+"}") { int temp = zzStartRead;
|
||||
addToken(temp, temp+3, Token.RESERVED_WORD);
|
||||
addToken(temp+4, temp+4, Token.SEPARATOR);
|
||||
addToken(temp+5, zzMarkedPos-2, Token.RESERVED_WORD);
|
||||
addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
|
||||
}
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
|
||||
"\n" |
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as identifiers. */
|
||||
{AnyChar}+ |
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,662 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 8/20/16 5:08 PM */
|
||||
/*
|
||||
* 04/24/2012
|
||||
* LatexTokenMaker.java - Scanner for LaTeX.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for the LaTeX.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RSTA always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>LatexTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class LatexTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int EOL_COMMENT = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\3\1\32\1\0\1\3\23\0\1\3\1\5\1\0\1\5"
|
||||
+ "\1\7\1\4\7\5\1\2\1\22\1\6\12\1\1\20\1\5\1\0" + "\1\5\1\0\2\5\32\1\1\5\1\23\1\5\1\0\1\2\1\0"
|
||||
+ "\1\1\1\25\1\1\1\31\1\17\1\14\1\26\1\10\1\15\2\1" + "\1\16\1\1\1\27\1\1\1\12\2\1\1\13\1\11\2\1\1\21"
|
||||
+ "\3\1\1\30\1\0\1\24\1\5\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\2\0\2\1\1\2\1\3\1\1\1\4\1\5\4\6"
|
||||
+ "\1\7\1\10\1\11\2\10\4\0\2\10\4\0\2\10" + "\2\0\1\12\1\0\1\10\3\0\1\10\1\13\2\0" + "\1\14";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[43];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\33\0\66\0\121\0\66\0\66\0\154\0\66"
|
||||
+ "\0\66\0\207\0\242\0\275\0\330\0\66\0\363\0\66"
|
||||
+ "\0\u010e\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195\0\u01b0\0\u01cb"
|
||||
+ "\0\u01e6\0\u0201\0\u021c\0\u0237\0\u0252\0\u026d\0\u0288\0\u02a3"
|
||||
+ "\0\u02be\0\u02d9\0\u02f4\0\u030f\0\u02be\0\u032a\0\u0345\0\66" + "\0\u0360\0\u037b\0\66";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[43];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\2\4\1\5\1\6\3\3\10\4\1\3\1\4"
|
||||
+ "\1\3\1\7\1\10\3\4\1\10\1\4\1\11\10\12" + "\1\13\3\12\1\14\4\12\1\15\10\12\1\16\34\0"
|
||||
+ "\2\4\5\0\10\4\1\0\1\4\3\0\3\4\1\0" + "\1\4\2\0\2\17\1\0\1\20\3\0\7\17\1\21"
|
||||
+ "\1\0\1\17\3\0\1\22\2\17\1\0\1\17\1\0" + "\10\12\1\0\3\12\1\0\4\12\1\0\10\12\12\0"
|
||||
+ "\1\23\32\0\1\24\3\0\1\25\36\0\1\26\12\0" + "\2\17\5\0\10\17\1\0\1\17\3\0\3\17\1\0"
|
||||
+ "\1\17\2\0\2\17\5\0\10\17\1\0\1\17\3\0" + "\2\17\1\27\1\0\1\17\2\0\2\17\5\0\7\17"
|
||||
+ "\1\30\1\0\1\17\3\0\3\17\1\0\1\17\12\0" + "\1\31\33\0\1\32\36\0\1\33\35\0\1\34\12\0"
|
||||
+ "\2\17\5\0\10\17\1\0\1\17\3\0\3\17\1\0" + "\1\35\2\0\2\17\5\0\10\17\1\0\1\17\3\0"
|
||||
+ "\1\17\1\36\1\17\1\0\1\17\13\0\1\37\40\0" + "\1\40\31\0\1\32\35\0\1\41\11\0\2\17\5\0"
|
||||
+ "\10\17\1\0\1\17\3\0\3\17\1\42\1\17\2\0" + "\2\17\5\0\5\17\1\43\2\17\1\0\1\17\3\0"
|
||||
+ "\3\17\1\0\1\17\14\0\1\32\4\0\1\40\20\0" + "\1\44\25\0\1\41\1\45\1\0\2\45\12\41\1\45"
|
||||
+ "\1\41\1\45\2\0\3\41\1\0\1\41\2\0\2\46" + "\5\0\10\46\1\0\1\46\3\0\3\46\1\0\1\46"
|
||||
+ "\2\0\2\17\5\0\10\17\1\0\1\17\3\0\2\17" + "\1\47\1\0\1\17\7\0\1\41\25\0\2\46\5\0"
|
||||
+ "\10\46\1\0\1\46\2\0\1\50\3\46\1\0\1\46" + "\2\0\2\17\5\0\10\17\1\0\1\17\3\0\3\17"
|
||||
+ "\1\51\1\17\2\0\2\52\5\0\10\52\1\0\1\52" + "\3\0\3\52\1\0\1\52\2\0\2\52\5\0\10\52"
|
||||
+ "\1\0\1\52\2\0\1\53\3\52\1\0\1\52\1\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[918];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\1\1\2\11\1\1\2\11\4\1\1\11"
|
||||
+ "\1\1\1\11\2\1\4\0\2\1\4\0\2\1\2\0" + "\1\1\1\0\1\1\3\0\1\1\1\11\2\0\1\11";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[43];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public LatexTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start, end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* ${inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "%", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
* @exception IOException if any I/O-Error occurs.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public LatexTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public LatexTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 112) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 13:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.FUNCTION);
|
||||
}
|
||||
case 14:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 15:
|
||||
break;
|
||||
case 12: {
|
||||
int temp = zzStartRead;
|
||||
addToken(temp, temp + 5, Token.RESERVED_WORD);
|
||||
addToken(temp + 6, temp + 6, Token.SEPARATOR);
|
||||
addToken(temp + 7, zzMarkedPos - 2, Token.RESERVED_WORD);
|
||||
addToken(zzMarkedPos - 1, zzMarkedPos - 1, Token.SEPARATOR);
|
||||
}
|
||||
case 16:
|
||||
break;
|
||||
case 10: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 3: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(EOL_COMMENT);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 11: {
|
||||
int temp = zzStartRead;
|
||||
addToken(temp, temp + 3, Token.RESERVED_WORD);
|
||||
addToken(temp + 4, temp + 4, Token.SEPARATOR);
|
||||
addToken(temp + 5, zzMarkedPos - 2, Token.RESERVED_WORD);
|
||||
addToken(zzMarkedPos - 1, zzMarkedPos - 1, Token.SEPARATOR);
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 5: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 9: {
|
||||
int temp = zzStartRead;
|
||||
addToken(temp, temp, Token.SEPARATOR);
|
||||
addToken(temp + 1, temp + 1, Token.IDENTIFIER);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 6: {
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case EOL_COMMENT: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 44:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 45:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 08/23/2015
|
||||
* Copyright (C) 2015 Robert Futrell
|
||||
* robert_futrell at users.sourceforge.net
|
||||
* http://fifesoft.com/rsyntaxtextarea
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSTALanguageSupport.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.TokenTypes;
|
||||
|
||||
/**
|
||||
* Scanner for Less files.
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*/
|
||||
public class LessTokenMaker extends CSSTokenMaker {
|
||||
|
||||
/**
|
||||
* Constructor; overridden to enable the niceties added by Less.
|
||||
*/
|
||||
public LessTokenMaker() {
|
||||
setHighlightingLess(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type == TokenTypes.VARIABLE || super.getMarkOccurrencesOfTokenType(type);
|
||||
}
|
||||
}
|
||||
@@ -1,429 +0,0 @@
|
||||
/*
|
||||
* 11/13/2004
|
||||
*
|
||||
* LispTokenMaker.java - Scanner for the Lisp programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Lisp programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>LispTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class LispTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public LispTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { ";", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
MLCBegin = "#|"
|
||||
MLCEnd = "|#"
|
||||
LineCommentBegin = ";"
|
||||
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
|
||||
Separator = ([\(\)])
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator})
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state STRING
|
||||
%state MLC
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
"defclass" |
|
||||
"defconstant" |
|
||||
"defgeneric" |
|
||||
"define-compiler-macro" |
|
||||
"define-condition" |
|
||||
"define-method-combination" |
|
||||
"define-modify-macro" |
|
||||
"define-setf-expander" |
|
||||
"define-symbol-macro" |
|
||||
"defmacro" |
|
||||
"defmethod" |
|
||||
"defpackage" |
|
||||
"defparameter" |
|
||||
"defsetf" |
|
||||
"defstruct" |
|
||||
"deftype" |
|
||||
"defun" |
|
||||
"defvar" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
"abort" |
|
||||
"assert" |
|
||||
"block" |
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"ccase" |
|
||||
"cerror" |
|
||||
"cond" |
|
||||
"ctypecase" |
|
||||
"declaim" |
|
||||
"declare" |
|
||||
"do" |
|
||||
"do*" |
|
||||
"do-all-symbols" |
|
||||
"do-external-symbols" |
|
||||
"do-symbols" |
|
||||
"dolist" |
|
||||
"dotimes" |
|
||||
"ecase" |
|
||||
"error" |
|
||||
"etypecase" |
|
||||
"eval-when" |
|
||||
"flet" |
|
||||
"handler-bind" |
|
||||
"handler-case" |
|
||||
"if" |
|
||||
"ignore-errors" |
|
||||
"in-package" |
|
||||
"labels" |
|
||||
"lambda" |
|
||||
"let" |
|
||||
"let*" |
|
||||
"locally" |
|
||||
"loop" |
|
||||
"macrolet" |
|
||||
"multiple-value-bind" |
|
||||
"proclaim" |
|
||||
"prog" |
|
||||
"prog*" |
|
||||
"prog1" |
|
||||
"prog2" |
|
||||
"progn" |
|
||||
"progv" |
|
||||
"provide" |
|
||||
"require" |
|
||||
"restart-bind" |
|
||||
"restart-case" |
|
||||
"restart-name" |
|
||||
"return" |
|
||||
"return-from" |
|
||||
"signal" |
|
||||
"symbol-macrolet" |
|
||||
"tagbody" |
|
||||
"the" |
|
||||
"throw" |
|
||||
"typecase" |
|
||||
"unless" |
|
||||
"unwind-protect" |
|
||||
"when" |
|
||||
"with-accessors" |
|
||||
"with-compilation-unit" |
|
||||
"with-condition-restarts" |
|
||||
"with-hash-table-iterator" |
|
||||
"with-input-from-string" |
|
||||
"with-open-file" |
|
||||
"with-open-stream" |
|
||||
"with-output-to-string" |
|
||||
"with-package-iterator" |
|
||||
"with-simple-restart" |
|
||||
"with-slots" |
|
||||
"with-standard-io-syntax" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
[\"] { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^hwf\n\|]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\| {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,369 +0,0 @@
|
||||
/*
|
||||
* 07/14/2006
|
||||
*
|
||||
* LuaTokenMaker.java - Scanner for the Lua programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Lua programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>LuaTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class LuaTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public LuaTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "--", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = LONGSTRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z_]
|
||||
Digit = [0-9]
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
UnclosedCharLiteral = ([\']([^\'\n]|"\\'")*)
|
||||
CharLiteral = ({UnclosedCharLiteral}"'")
|
||||
UnclosedStringLiteral = ([\"]([^\"\n]|"\\\"")*)
|
||||
StringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
LongStringBegin = ("[[")
|
||||
LongStringEnd = ("]]")
|
||||
|
||||
LineCommentBegin = ("--")
|
||||
MLCBegin = ({LineCommentBegin}{LongStringBegin})
|
||||
|
||||
Number = ( "."? {Digit} ({Digit}|".")* ([eE][+-]?)? ({Letter}|{Digit})* )
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\(\)\{\}\[\]\]])
|
||||
Separator2 = ([\;:,.])
|
||||
|
||||
ArithmeticOperator = ("+"|"-"|"*"|"/"|"^"|"%")
|
||||
RelationalOperator = ("<"|">"|"<="|">="|"=="|"~=")
|
||||
LogicalOperator = ("and"|"or"|"not"|"#")
|
||||
ConcatenationOperator = ("..")
|
||||
Elipsis = ({ConcatenationOperator}".")
|
||||
Operator = ({ArithmeticOperator}|{RelationalOperator}|{LogicalOperator}|{ConcatenationOperator}|{Elipsis})
|
||||
|
||||
Identifier = ({Letter}({Letter}|{Digit})*)
|
||||
|
||||
|
||||
%state MLC
|
||||
%state LONGSTRING
|
||||
%state LINECOMMENT
|
||||
|
||||
|
||||
%%
|
||||
|
||||
/* Keywords */
|
||||
<YYINITIAL> "break" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "do" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "else" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "elseif" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "end" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "for" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "function" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "if" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "local" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "nil" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "repeat" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "return" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "then" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "until" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "while" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Data types. */
|
||||
<YYINITIAL> "<number>" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "<name>" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "<string>" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "<eof>" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "NULL" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Functions. */
|
||||
<YYINITIAL> "_G" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "_VERSION" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "assert" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "collectgarbage" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "dofile" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "error" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "getfenv" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "getmetatable" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "ipairs" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "load" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "loadfile" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "loadstring" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "module" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "next" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "pairs" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "pcall" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "print" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "rawequal" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "rawget" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "rawset" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "require" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "select" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "setfenv" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "setmetatable" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "tonumber" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "tostring" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "type" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "unpack" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "xpcall" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Booleans. */
|
||||
<YYINITIAL> {BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{LongStringBegin} { start = zzMarkedPos-2; yybegin(LONGSTRING); }
|
||||
|
||||
/* Comment literals. */
|
||||
{MLCBegin} { start = zzMarkedPos-4; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(LINECOMMENT); }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Identifiers - Comes after Operators for "and", "not" and "or". */
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Numbers */
|
||||
{Number} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<MLC> {
|
||||
[^\n\]]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{LongStringEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\] {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<LONGSTRING> {
|
||||
[^\n\]]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
{LongStringEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\] {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<LINECOMMENT> {
|
||||
[^\n]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_EOL); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); return firstToken; }
|
||||
}
|
||||
@@ -1,834 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 10/16/06 10:31 AM */
|
||||
/*
|
||||
* 07/14/2006
|
||||
* LuaTokenMaker.java - Scanner for the Lua programming language.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for the Lua programming language.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>LuaTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
public class LuaTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int LONGSTRING = 2;
|
||||
public static final int LINECOMMENT = 3;
|
||||
public static final int MLC = 1;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\4\1\3\1\0\1\4\23\0\1\4\1\0\1\7\1\27"
|
||||
+ "\1\0\1\27\1\0\1\5\2\26\1\27\1\15\1\0\1\12\1\13" + "\1\27\12\2\2\0\1\30\1\32\1\31\2\0\4\1\1\14\1\1"
|
||||
+ "\1\54\1\1\1\60\2\1\1\52\1\1\1\50\1\61\2\1\1\56" + "\1\57\1\1\1\51\1\55\4\1\1\10\1\6\1\11\1\27\1\53"
|
||||
+ "\1\0\1\23\1\37\1\42\1\35\1\21\1\22\1\47\1\44\1\41" + "\1\1\1\40\1\24\1\46\1\34\1\36\1\43\1\64\1\17\1\25"
|
||||
+ "\1\16\1\20\1\62\1\45\1\63\1\65\1\1\1\26\1\0\1\26" + "\1\33\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\4\0\2\1\1\2\1\3\1\4\1\5\1\6\2\7"
|
||||
+ "\1\10\1\1\1\10\10\1\2\10\16\1\1\11\1\12" + "\1\11\1\13\2\11\1\14\2\2\1\15\1\5\1\6"
|
||||
+ "\1\16\1\17\1\20\1\10\21\1\3\0\3\1\1\21" + "\1\10\1\1\1\21\11\1\1\22\2\1\1\23\1\24"
|
||||
+ "\1\15\1\16\1\0\24\1\4\0\13\1\1\25\1\26" + "\11\1\1\21\2\1\1\22\3\1\4\0\6\1\1\27"
|
||||
+ "\13\1\1\27\2\0\10\1\2\0\15\1";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[201];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\66\0\154\0\242\0\330\0\u010e\0\u0144\0\330"
|
||||
+ "\0\u017a\0\u01b0\0\u01e6\0\u021c\0\330\0\u0252\0\u0288\0\330"
|
||||
+ "\0\u02be\0\u02f4\0\u032a\0\u0360\0\u0396\0\u03cc\0\u0402\0\u0438"
|
||||
+ "\0\u046e\0\u04a4\0\u04a4\0\u04da\0\u0510\0\u0546\0\u057c\0\u05b2"
|
||||
+ "\0\u05e8\0\u061e\0\u0654\0\u068a\0\u06c0\0\u06f6\0\u072c\0\u0762"
|
||||
+ "\0\u0798\0\330\0\u07ce\0\330\0\u0804\0\u083a\0\330\0\u0870"
|
||||
+ "\0\u08a6\0\330\0\u08dc\0\u0912\0\330\0\330\0\u0948\0\u097e"
|
||||
+ "\0\u09b4\0\u09ea\0\u0a20\0\u0a56\0\u0a8c\0\u0ac2\0\u0af8\0\u0b2e"
|
||||
+ "\0\u0b64\0\u0b9a\0\u0bd0\0\u0c06\0\u0c3c\0\u0c72\0\u0ca8\0\u0cde"
|
||||
+ "\0\u0d14\0\u0d4a\0\u0d80\0\u0db6\0\u0dec\0\u0e22\0\u0e58\0\u0e8e"
|
||||
+ "\0\u010e\0\u0ec4\0\u010e\0\u0efa\0\u0f30\0\u0f66\0\u0f9c\0\u0fd2"
|
||||
+ "\0\u1008\0\u103e\0\u1074\0\u10aa\0\u010e\0\u10e0\0\u1116\0\330"
|
||||
+ "\0\330\0\u01b0\0\u01e6\0\u114c\0\u1182\0\u11b8\0\u11ee\0\u1224"
|
||||
+ "\0\u125a\0\u1290\0\u12c6\0\u12fc\0\u1332\0\u1368\0\u139e\0\u13d4"
|
||||
+ "\0\u140a\0\u1440\0\u1476\0\u14ac\0\u14e2\0\u1518\0\u154e\0\u1584"
|
||||
+ "\0\u15ba\0\u15f0\0\u1626\0\u165c\0\u1692\0\u16c8\0\u16fe\0\u1734"
|
||||
+ "\0\u176a\0\u17a0\0\u17d6\0\u180c\0\u1842\0\u1878\0\u18ae\0\330"
|
||||
+ "\0\u010e\0\u18e4\0\u191a\0\u1950\0\u1986\0\u19bc\0\u19f2\0\u1a28"
|
||||
+ "\0\u1a5e\0\u1a94\0\u1aca\0\u1b00\0\u1b36\0\u1b6c\0\u1ba2\0\u1bd8"
|
||||
+ "\0\u1c0e\0\u1c44\0\u1c7a\0\u1cb0\0\u1ce6\0\u1d1c\0\u1d52\0\u1d88"
|
||||
+ "\0\u1dbe\0\u1df4\0\u1e2a\0\u010e\0\u1e60\0\u1e96\0\u1ecc\0\u1f02"
|
||||
+ "\0\u1f38\0\u1f6e\0\u1fa4\0\u1fda\0\u2010\0\u2046\0\u207c\0\330"
|
||||
+ "\0\u20b2\0\u20e8\0\u211e\0\u2154\0\u218a\0\u21c0\0\u21f6\0\u222c"
|
||||
+ "\0\u2262\0\u2298\0\u22ce\0\u2304\0\u233a\0\u2370\0\u23a6\0\u23dc"
|
||||
+ "\0\u2412\0\u2448\0\u247e\0\u24b4\0\u24ea\0\u2520\0\u2556\0\u258c" + "\0\u25c2";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[201];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\5\1\6\1\7\1\10\1\11\1\12\1\5\1\13"
|
||||
+ "\1\14\1\15\1\16\1\17\1\6\1\20\1\21\1\22" + "\1\23\1\24\1\25\1\26\1\27\1\30\1\15\1\20"
|
||||
+ "\1\31\1\32\2\33\1\34\1\35\1\36\1\37\1\6" + "\1\40\1\41\1\42\1\6\1\43\1\44\1\45\1\46"
|
||||
+ "\2\6\1\47\7\6\1\50\2\6\3\51\1\52\5\51" + "\1\53\57\51\1\54\5\51\1\55\54\51\3\56\1\57"
|
||||
+ "\62\56\67\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\32\6\1\0\1\60\1\7\10\0\1\7\1\61\1\0"
|
||||
+ "\3\60\1\61\4\60\6\0\32\60\4\0\1\11\61\0" + "\3\12\1\0\1\12\1\62\1\63\57\12\3\13\1\0"
|
||||
+ "\2\13\1\64\1\65\56\13\10\0\1\66\67\0\1\67" + "\55\0\1\7\10\0\1\70\53\0\2\6\11\0\1\6"
|
||||
+ "\1\0\1\6\1\71\6\6\6\0\2\6\1\72\5\6" + "\1\73\20\6\1\74\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\3\6\1\75\1\6\1\76\2\6\6\0\32\6\1\0" + "\2\6\11\0\1\6\1\0\10\6\6\0\1\77\31\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\1\6\1\100\4\6" + "\1\101\1\6\6\0\1\102\31\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\2\6\1\103\2\6\1\104\2\6\6\0" + "\2\6\1\105\27\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\7\6\1\106\6\0\1\107\31\6\1\0\2\6\11\0" + "\1\6\1\0\10\6\6\0\2\6\1\110\27\6\1\0"
|
||||
+ "\2\6\11\0\1\6\1\0\3\6\1\111\4\6\6\0" + "\32\6\21\0\1\112\3\0\1\113\4\0\1\20\1\0"
|
||||
+ "\1\114\63\0\1\20\34\0\2\6\11\0\1\6\1\0" + "\3\6\1\115\4\6\6\0\2\6\1\116\2\6\1\117"
|
||||
+ "\24\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\2\6\1\120\27\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\1\6\1\121\6\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\1\6\1\122\6\6\6\0\32\6\1\0"
|
||||
+ "\2\6\11\0\1\6\1\0\4\6\1\123\3\6\6\0" + "\7\6\1\124\22\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\10\6\6\0\2\6\1\125\27\6\1\0\2\6\11\0" + "\1\6\1\0\1\6\1\126\3\6\1\127\2\6\6\0"
|
||||
+ "\6\6\1\130\23\6\1\0\2\6\11\0\1\6\1\0" + "\10\6\6\0\10\6\1\131\21\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\10\6\6\0\2\6\1\132\27\6\1\0" + "\2\6\11\0\1\6\1\0\3\6\1\133\4\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\15\6\1\134\14\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\10\6\6\0\20\6\1\135\1\136\10\6\1\0\2\6" + "\11\0\1\6\1\0\10\6\6\0\7\6\1\137\22\6"
|
||||
+ "\3\51\1\0\5\51\1\0\54\51\11\0\1\140\65\0" + "\1\141\54\0\3\56\1\0\62\56\1\0\2\60\11\0"
|
||||
+ "\1\60\1\0\10\60\6\0\32\60\1\0\2\60\7\0" + "\1\60\1\0\12\60\6\0\32\60\3\12\1\0\1\12"
|
||||
+ "\1\142\1\63\57\12\3\13\1\0\2\13\1\64\1\143" + "\56\13\10\0\1\144\70\0\1\20\53\0\2\6\11\0"
|
||||
+ "\1\6\1\0\2\6\1\145\5\6\6\0\32\6\1\0" + "\2\6\11\0\1\6\1\0\7\6\1\146\6\0\1\147"
|
||||
+ "\31\6\1\0\2\6\11\0\1\6\1\0\3\6\1\150" + "\4\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\10\6\6\0\7\6\1\151\22\6\1\0\2\6\11\0" + "\1\6\1\0\1\152\7\6\6\0\7\6\1\153\20\6"
|
||||
+ "\1\154\1\6\1\0\2\6\11\0\1\6\1\0\10\6" + "\6\0\11\6\1\155\20\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\1\156\7\6\6\0\7\6\1\157\22\6\1\0" + "\2\6\11\0\1\6\1\0\1\6\1\160\6\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\7\6\1\161" + "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"
|
||||
+ "\6\0\1\6\1\123\30\6\1\0\2\6\11\0\1\6" + "\1\0\10\6\6\0\1\162\31\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\6\6\1\163\1\6\6\0\32\6\1\0" + "\2\6\11\0\1\6\1\0\1\6\1\123\6\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\7\6\1\164" + "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"
|
||||
+ "\6\0\1\6\1\121\30\6\1\0\2\6\11\0\1\6" + "\1\0\5\6\1\165\2\6\6\0\6\6\1\166\23\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\1\167\5\6\1\170" + "\1\6\6\0\32\6\36\0\1\171\45\0\1\172\67\0"
|
||||
+ "\1\173\2\0\1\174\43\0\2\6\11\0\1\6\1\0" + "\10\6\6\0\27\6\1\175\2\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\1\121\7\6\6\0\32\6\1\0\2\6" + "\11\0\1\6\1\0\6\6\1\123\1\6\6\0\32\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\4\6\1\176\3\6" + "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\3\6"
|
||||
+ "\1\177\4\6\6\0\32\6\1\0\2\6\11\0\1\6" + "\1\0\5\6\1\127\2\6\6\0\32\6\1\0\2\6"
|
||||
+ "\11\0\1\6\1\0\6\6\1\200\1\6\6\0\32\6" + "\1\0\2\6\11\0\1\6\1\0\10\6\6\0\5\6"
|
||||
+ "\1\201\24\6\1\0\2\6\11\0\1\6\1\0\10\6" + "\6\0\5\6\1\202\24\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\5\6\1\203\2\6\6\0\32\6\1\0\2\6" + "\11\0\1\6\1\0\10\6\6\0\5\6\1\204\24\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\10\6\6\0\1\6" + "\1\205\30\6\1\0\2\6\11\0\1\6\1\0\1\167"
|
||||
+ "\7\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0" + "\10\6\6\0\16\6\1\206\13\6\1\0\2\6\11\0"
|
||||
+ "\1\207\1\0\10\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\10\6\6\0\6\6\1\130\23\6\10\0"
|
||||
+ "\1\210\56\0\2\6\11\0\1\6\1\0\3\6\1\211" + "\4\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\1\212\7\6\6\0\32\6\1\0\2\6\11\0\1\6" + "\1\0\2\6\1\213\5\6\6\0\32\6\1\0\2\6"
|
||||
+ "\11\0\1\6\1\0\10\6\6\0\1\123\31\6\1\0" + "\2\6\11\0\1\6\1\0\3\6\1\135\4\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\2\6\1\214" + "\5\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\3\6\1\215\4\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\2\6\1\216\5\6\6\0\32\6\1\0"
|
||||
+ "\2\6\11\0\1\6\1\0\3\6\1\217\3\6\1\220" + "\6\0\13\6\1\220\16\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\10\6\6\0\5\6\1\117\24\6\1\0\2\6" + "\11\0\1\6\1\0\5\6\1\221\2\6\6\0\32\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\10\6\6\0\2\6" + "\1\222\27\6\1\0\2\6\11\0\1\6\1\0\3\6"
|
||||
+ "\1\223\4\6\6\0\32\6\1\0\2\6\11\0\1\6" + "\1\0\10\6\6\0\6\6\1\224\23\6\1\0\2\6"
|
||||
+ "\11\0\1\6\1\0\7\6\1\145\6\0\32\6\1\0" + "\2\6\11\0\1\6\1\0\3\6\1\225\4\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\1\6\1\226\30\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\5\6\1\117\2\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\4\6\1\227\3\6\6\0\12\6\1\230"
|
||||
+ "\17\6\1\0\2\6\11\0\1\6\1\0\3\6\1\231" + "\4\6\6\0\32\6\22\0\1\232\62\0\1\233\114\0"
|
||||
+ "\1\234\65\0\1\235\20\0\2\6\11\0\1\6\1\0" + "\1\135\7\6\6\0\32\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\10\6\6\0\5\6\1\236\24\6\1\0\2\6" + "\11\0\1\6\1\0\5\6\1\237\2\6\6\0\32\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\6\6\1\240\1\6" + "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"
|
||||
+ "\6\0\1\175\31\6\1\0\2\6\11\0\1\6\1\0" + "\1\6\1\241\6\6\6\0\32\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\6\6\1\242\1\6\6\0\32\6\1\0" + "\2\6\11\0\1\6\1\0\6\6\1\243\1\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\2\6\1\236" + "\5\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\10\6\6\0\16\6\1\244\13\6\1\0\2\6\11\0" + "\1\6\1\0\10\6\6\0\22\6\1\245\7\6\1\0"
|
||||
+ "\2\6\11\0\1\6\1\0\1\6\1\246\6\6\6\0" + "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"
|
||||
+ "\12\6\1\247\17\6\1\0\2\6\11\0\1\6\1\0" + "\1\6\1\150\6\6\6\0\32\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\5\6\1\250\2\6\6\0\32\6\1\0" + "\2\6\11\0\1\6\1\0\10\6\6\0\5\6\1\251"
|
||||
+ "\24\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\30\6\1\252\1\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\3\6\1\175\4\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\10\6\6\0\6\6\1\253\23\6\1\0"
|
||||
+ "\2\6\11\0\1\6\1\0\1\6\1\135\6\6\6\0" + "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"
|
||||
+ "\5\6\1\254\24\6\1\0\2\6\11\0\1\6\1\0" + "\1\255\7\6\6\0\32\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\1\6\1\175\6\6\6\0\32\6\1\0\2\6" + "\11\0\1\6\1\0\4\6\1\176\2\6\1\146\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\3\6\1\256" + "\4\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\3\6\1\257\4\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\10\6\6\0\6\6\1\175\23\6\31\0"
|
||||
+ "\1\260\75\0\1\261\63\0\1\262\47\0\1\232\45\0" + "\2\6\11\0\1\6\1\0\6\6\1\151\1\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\4\6\1\123\25\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\3\6\1\263\4\6\6\0\32\6\1\0\2\6\11\0" + "\1\6\1\0\7\6\1\135\6\0\32\6\1\0\2\6"
|
||||
+ "\11\0\1\6\1\0\6\6\1\135\1\6\6\0\32\6" + "\1\0\2\6\11\0\1\6\1\0\3\6\1\123\4\6"
|
||||
+ "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6" + "\6\0\23\6\1\264\6\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\10\6\6\0\5\6\1\265\24\6\1\0\2\6" + "\11\0\1\6\1\0\10\6\6\0\3\6\1\266\26\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\1\123\7\6\6\0" + "\32\6\1\0\2\6\11\0\1\6\1\0\1\6\1\151"
|
||||
+ "\6\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0" + "\2\6\1\267\5\6\6\0\32\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\10\6\6\0\4\6\1\135\25\6\1\0" + "\2\6\11\0\1\6\1\0\4\6\1\123\3\6\6\0"
|
||||
+ "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\5\6\1\270\24\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\10\6\6\0\1\271\31\6\1\0\2\6\11\0\1\6" + "\1\0\1\272\7\6\6\0\32\6\34\0\1\273\52\0"
|
||||
+ "\1\274\45\0\2\6\11\0\1\6\1\0\10\6\6\0" + "\6\6\1\275\23\6\1\0\2\6\11\0\1\6\1\0"
|
||||
+ "\10\6\6\0\24\6\1\276\5\6\1\0\2\6\11\0" + "\1\6\1\0\10\6\6\0\1\277\31\6\1\0\2\6"
|
||||
+ "\11\0\1\6\1\0\3\6\1\222\4\6\6\0\32\6" + "\1\0\2\6\11\0\1\6\1\0\5\6\1\242\2\6"
|
||||
+ "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6" + "\6\0\2\6\1\150\27\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\10\6\6\0\26\6\1\135\3\6\1\0\2\6" + "\11\0\1\6\1\0\5\6\1\300\2\6\6\0\32\6"
|
||||
+ "\47\0\1\232\35\0\1\232\47\0\2\6\11\0\1\6" + "\1\0\1\301\7\6\6\0\32\6\1\0\2\6\11\0"
|
||||
+ "\1\6\1\0\10\6\6\0\25\6\1\302\4\6\1\0" + "\2\6\11\0\1\6\1\0\10\6\6\0\13\6\1\135"
|
||||
+ "\16\6\1\0\2\6\11\0\1\6\1\0\1\303\7\6" + "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"
|
||||
+ "\6\0\13\6\1\304\16\6\1\0\2\6\11\0\1\6" + "\1\0\10\6\6\0\14\6\1\135\15\6\1\0\2\6"
|
||||
+ "\11\0\1\6\1\0\5\6\1\305\2\6\6\0\32\6" + "\1\0\2\6\11\0\1\6\1\0\5\6\1\306\2\6"
|
||||
+ "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6" + "\6\0\3\6\1\236\26\6\1\0\2\6\11\0\1\6"
|
||||
+ "\1\0\1\6\1\307\6\6\6\0\32\6\1\0\2\6" + "\11\0\1\6\1\0\10\6\6\0\3\6\1\310\26\6"
|
||||
+ "\1\0\2\6\11\0\1\6\1\0\5\6\1\311\2\6" + "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6" + "\6\0\13\6\1\151\16\6";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[9720];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\4\0\1\11\2\1\1\11\4\1\1\11\2\1\1\11"
|
||||
+ "\31\1\1\11\1\1\1\11\2\1\1\11\2\1\1\11" + "\2\1\2\11\23\1\3\0\23\1\2\11\2\1\1\0"
|
||||
+ "\24\1\4\0\13\1\1\11\21\1\4\0\22\1\1\11" + "\2\0\10\1\2\0\15\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[201];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public LuaTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "--", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = LONGSTRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public LuaTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public LuaTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 164) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 3: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 13: {
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 15: {
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(LONGSTRING);
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 19: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.LITERAL_NUMBER_FLOAT);
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 17: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 21: {
|
||||
start = zzMarkedPos - 4;
|
||||
yybegin(MLC);
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 33:
|
||||
break;
|
||||
case 18: {
|
||||
addToken(Token.FUNCTION);
|
||||
}
|
||||
case 34:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.ERROR_CHAR);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 35:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.ERROR_STRING_DOUBLE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 36:
|
||||
break;
|
||||
case 23: {
|
||||
addToken(Token.DATA_TYPE);
|
||||
}
|
||||
case 37:
|
||||
break;
|
||||
case 22: {
|
||||
addToken(Token.LITERAL_BOOLEAN);
|
||||
}
|
||||
case 38:
|
||||
break;
|
||||
case 20: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead + 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 39:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 40:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 41:
|
||||
break;
|
||||
case 12: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
return firstToken;
|
||||
}
|
||||
case 42:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 43:
|
||||
break;
|
||||
case 16: {
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(LINECOMMENT);
|
||||
}
|
||||
case 44:
|
||||
break;
|
||||
case 9: {
|
||||
}
|
||||
case 45:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
return firstToken;
|
||||
}
|
||||
case 46:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 202:
|
||||
break;
|
||||
case LONGSTRING: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 203:
|
||||
break;
|
||||
case LINECOMMENT: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
return firstToken;
|
||||
}
|
||||
case 204:
|
||||
break;
|
||||
case MLC: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
return firstToken;
|
||||
}
|
||||
case 205:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,333 +0,0 @@
|
||||
/*
|
||||
* 09/20/2008
|
||||
*
|
||||
* MakefileTokenMaker.java - Scanner for makefiles.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Stack;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for makefiles.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>MakefileTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class MakefileTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
private Stack<Boolean> varDepths;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public MakefileTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether tokens of the specified type should have "mark
|
||||
* occurrences" enabled for the current programming language.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences"
|
||||
* enabled.
|
||||
*/
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type==Token.IDENTIFIER || type==Token.VARIABLE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(Token.NULL);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
Digit = [0-9]
|
||||
IdentifierStart = ({Letter}|[_\.])
|
||||
IdentifierPart = ({IdentifierStart}|{Digit})
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
Label = ({Identifier}":")
|
||||
|
||||
CurlyVarStart = ("${")
|
||||
ParenVarStart = ("$(")
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
UnclosedCharLiteral = ([\']([^\'\n]|"\\'")*)
|
||||
CharLiteral = ({UnclosedCharLiteral}"'")
|
||||
UnclosedStringLiteral = ([\"]([^\"\n]|"\\\"")*)
|
||||
StringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
UnclosedBacktickLiteral = ([\`]([^\`\n]|"\\`")*)
|
||||
BacktickLiteral = ({UnclosedBacktickLiteral}"`")
|
||||
|
||||
LineCommentBegin = "#"
|
||||
|
||||
IntegerLiteral = ({Digit}+)
|
||||
|
||||
Operator = ([\:\+\?]?"=")
|
||||
|
||||
|
||||
%state VAR
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"addprefix" |
|
||||
"addsuffix" |
|
||||
"basename" |
|
||||
"dir" |
|
||||
"filter" |
|
||||
"filter-out" |
|
||||
"findstring" |
|
||||
"firstword" |
|
||||
"foreach" |
|
||||
"join" |
|
||||
"notdir" |
|
||||
"origin" |
|
||||
"pathsubst" |
|
||||
"shell" |
|
||||
"sort" |
|
||||
"strip" |
|
||||
"suffix" |
|
||||
"wildcard" |
|
||||
"word" |
|
||||
"words" |
|
||||
"ifeq" |
|
||||
"ifneq" |
|
||||
"else" |
|
||||
"endif" |
|
||||
"define" |
|
||||
"endef" |
|
||||
"ifdef" |
|
||||
"ifndef" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Label} { addToken(Token.PREPROCESSOR); }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{BacktickLiteral} { addToken(Token.LITERAL_BACKQUOTE); }
|
||||
{BacktickLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
|
||||
/* Variables. */
|
||||
{CurlyVarStart} { if (varDepths==null) { varDepths = new Stack<Boolean>(); } else { varDepths.clear(); } varDepths.push(Boolean.TRUE); start = zzMarkedPos-2; yybegin(VAR); }
|
||||
{ParenVarStart} { if (varDepths==null) { varDepths = new Stack<Boolean>(); } else { varDepths.clear(); } varDepths.push(Boolean.FALSE); start = zzMarkedPos-2; yybegin(VAR); }
|
||||
|
||||
/* Comment literals. */
|
||||
{LineCommentBegin}.* { addToken(Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch-all for anything else. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<VAR> {
|
||||
[^\}\)\$\#]+ {}
|
||||
"}" {
|
||||
if (!varDepths.empty() && varDepths.peek()==Boolean.TRUE) {
|
||||
varDepths.pop();
|
||||
if (varDepths.empty()) {
|
||||
addToken(start,zzStartRead, Token.VARIABLE); yybegin(YYINITIAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
")" {
|
||||
if (!varDepths.empty() && varDepths.peek()==Boolean.FALSE) {
|
||||
varDepths.pop();
|
||||
if (varDepths.empty()) {
|
||||
addToken(start,zzStartRead, Token.VARIABLE); yybegin(YYINITIAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
"${" { varDepths.push(Boolean.TRUE); }
|
||||
"$(" { varDepths.push(Boolean.FALSE); }
|
||||
"$" {}
|
||||
"#".* { int temp1 = zzStartRead; int temp2 = zzMarkedPos; addToken(start,zzStartRead-1, Token.VARIABLE); addToken(temp1, temp2-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.VARIABLE); addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,782 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 8/9/13 11:40 AM */
|
||||
/*
|
||||
* 09/20/2008
|
||||
* MakefileTokenMaker.java - Scanner for makefiles.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.Stack;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for makefiles.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>MakefileTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class MakefileTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int VAR = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\10\1\7\1\0\1\10\23\0\1\10\1\0\1\13\1\15"
|
||||
+ "\1\4\2\0\1\11\1\6\1\47\1\0\1\16\1\0\1\37\1\1" + "\1\0\12\2\1\3\2\0\1\17\1\0\1\16\1\0\32\1\1\0"
|
||||
+ "\1\12\2\0\1\1\1\14\1\20\1\32\1\43\1\21\1\24\1\25" + "\1\41\1\44\1\26\1\45\1\1\1\35\1\34\1\33\1\40\1\22"
|
||||
+ "\1\46\1\23\1\30\1\36\1\31\1\1\1\42\1\27\2\1\1\5" + "\1\0\1\50\uff82\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\2\0\2\1\1\2\2\1\1\3\1\4\1\5\1\6"
|
||||
+ "\1\1\1\7\1\10\14\1\2\11\1\12\1\13\1\14" + "\1\15\1\16\1\17\1\20\1\5\1\6\1\21\2\0"
|
||||
+ "\1\22\23\1\1\23\1\24\1\20\1\21\1\22\2\1" + "\1\25\43\1\1\25\14\1\1\25\5\1\1\0\2\1" + "\1\0\1\1\1\0\1\25";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[129];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\51\0\122\0\173\0\244\0\315\0\366\0\122"
|
||||
+ "\0\u011f\0\u0148\0\u0171\0\u019a\0\u01c3\0\122\0\u01ec\0\u0215"
|
||||
+ "\0\u023e\0\u0267\0\u0290\0\u02b9\0\u02e2\0\u030b\0\u0334\0\u035d"
|
||||
+ "\0\u0386\0\u03af\0\u03d8\0\u0401\0\u042a\0\122\0\122\0\122"
|
||||
+ "\0\122\0\122\0\122\0\u0453\0\u047c\0\122\0\u019a\0\u04a5"
|
||||
+ "\0\122\0\u04ce\0\u04f7\0\u0520\0\u0549\0\u0572\0\u059b\0\u05c4"
|
||||
+ "\0\u05ed\0\u0616\0\u063f\0\u0668\0\u0691\0\u06ba\0\u06e3\0\u070c"
|
||||
+ "\0\u0735\0\u075e\0\u0787\0\u07b0\0\122\0\122\0\u0148\0\u0171"
|
||||
+ "\0\u019a\0\u07d9\0\u0802\0\173\0\u082b\0\u0854\0\u087d\0\u08a6"
|
||||
+ "\0\u08cf\0\u08f8\0\u0921\0\u094a\0\u0973\0\u099c\0\u09c5\0\u09ee"
|
||||
+ "\0\u0a17\0\u0a40\0\u0a69\0\u0a92\0\u0abb\0\u0ae4\0\u0b0d\0\u0b36"
|
||||
+ "\0\u0b5f\0\u0b88\0\u0bb1\0\u0bda\0\u0c03\0\u0c2c\0\u0c55\0\u0c7e"
|
||||
+ "\0\u0ca7\0\u0cd0\0\u0cf9\0\u0d22\0\u0d4b\0\u0d74\0\u0d9d\0\u0dc6"
|
||||
+ "\0\u0def\0\u0e18\0\u0e41\0\u0e6a\0\u0e93\0\u0ebc\0\u0ee5\0\u0f0e"
|
||||
+ "\0\u0f37\0\u0f60\0\u0f89\0\u0fb2\0\u0fdb\0\u1004\0\u102d\0\u1056"
|
||||
+ "\0\u107f\0\u10a8\0\u10d1\0\u10fa\0\u1123\0\u114c\0\u1175\0\u119e" + "\0\122";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[129];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\1\5\1\6\1\7\2\3\1\10\1\11"
|
||||
+ "\1\12\1\3\1\13\1\14\1\15\1\6\1\16\1\17" + "\1\20\1\21\1\4\1\22\1\23\1\24\1\4\1\25"
|
||||
+ "\1\4\1\26\1\27\3\4\1\3\1\30\1\4\1\31" + "\2\4\1\32\1\4\2\3\4\33\1\34\10\33\1\35"
|
||||
+ "\31\33\1\36\1\37\52\0\2\4\1\40\14\0\17\4" + "\1\0\7\4\4\0\1\5\65\0\1\16\36\0\1\41"
|
||||
+ "\1\42\52\0\1\11\40\0\7\12\1\0\1\12\1\43" + "\1\44\36\12\7\13\1\0\2\13\1\45\1\46\35\13"
|
||||
+ "\7\47\1\0\2\47\1\50\1\47\1\51\34\47\7\15" + "\1\0\41\15\1\0\2\4\1\40\14\0\1\4\1\52"
|
||||
+ "\15\4\1\0\7\4\3\0\2\4\1\40\14\0\4\4" + "\1\53\1\4\1\54\10\4\1\0\7\4\3\0\2\4"
|
||||
+ "\1\40\14\0\1\55\16\4\1\0\7\4\3\0\2\4" + "\1\40\14\0\13\4\1\56\1\4\1\57\1\4\1\0"
|
||||
+ "\7\4\3\0\2\4\1\40\14\0\6\4\1\60\10\4" + "\1\0\1\61\6\4\3\0\2\4\1\40\14\0\5\4"
|
||||
+ "\1\62\11\4\1\0\7\4\3\0\2\4\1\40\14\0" + "\11\4\1\63\4\4\1\64\1\0\1\65\3\4\1\66"
|
||||
+ "\2\4\3\0\2\4\1\40\14\0\1\67\16\4\1\0" + "\7\4\3\0\2\4\1\40\14\0\17\4\1\0\1\70"
|
||||
+ "\6\4\3\0\2\4\1\40\14\0\3\4\1\71\13\4" + "\1\0\7\4\3\0\2\4\1\40\14\0\6\4\1\72"
|
||||
+ "\10\4\1\0\1\73\6\4\3\0\2\4\1\40\14\0" + "\17\4\1\0\1\74\6\4\2\0\4\33\1\0\10\33"
|
||||
+ "\1\0\31\33\7\0\1\75\1\76\42\0\7\35\1\0" + "\41\35\7\12\1\0\1\12\1\77\1\44\36\12\7\13"
|
||||
+ "\1\0\2\13\1\45\1\100\35\13\7\47\1\0\2\47" + "\1\50\1\47\1\101\34\47\1\0\2\4\1\40\14\0"
|
||||
+ "\1\4\1\102\15\4\1\0\7\4\3\0\2\4\1\40" + "\14\0\5\4\1\103\11\4\1\0\7\4\3\0\2\4"
|
||||
+ "\1\40\14\0\3\4\1\104\13\4\1\0\7\4\3\0" + "\2\4\1\40\14\0\16\4\1\105\1\0\7\4\3\0"
|
||||
+ "\2\4\1\40\14\0\1\4\1\106\15\4\1\0\7\4" + "\3\0\2\4\1\40\14\0\10\4\1\107\6\4\1\0"
|
||||
+ "\7\4\3\0\2\4\1\40\14\0\3\4\1\110\7\4" + "\1\111\1\4\1\112\1\4\1\0\7\4\3\0\2\4"
|
||||
+ "\1\40\14\0\3\4\1\113\13\4\1\0\7\4\3\0" + "\2\4\1\40\14\0\1\4\1\114\2\4\1\115\6\4"
|
||||
+ "\1\116\3\4\1\0\7\4\3\0\2\4\1\40\14\0" + "\5\4\1\117\11\4\1\0\7\4\3\0\2\4\1\40"
|
||||
+ "\14\0\3\4\1\120\13\4\1\0\7\4\3\0\2\4" + "\1\40\14\0\3\4\1\121\13\4\1\0\7\4\3\0"
|
||||
+ "\2\4\1\40\14\0\4\4\1\122\12\4\1\0\7\4" + "\3\0\2\4\1\40\14\0\10\4\1\123\6\4\1\0"
|
||||
+ "\7\4\3\0\2\4\1\40\14\0\16\4\1\124\1\0" + "\7\4\3\0\2\4\1\40\14\0\6\4\1\125\10\4"
|
||||
+ "\1\0\7\4\3\0\2\4\1\40\14\0\15\4\1\126" + "\1\4\1\0\7\4\3\0\2\4\1\40\14\0\3\4"
|
||||
+ "\1\127\13\4\1\0\7\4\3\0\2\4\1\40\14\0" + "\6\4\1\130\10\4\1\0\7\4\3\0\2\4\1\40"
|
||||
+ "\14\0\2\4\1\131\5\4\1\132\6\4\1\0\7\4" + "\3\0\2\4\1\40\14\0\6\4\1\133\10\4\1\0"
|
||||
+ "\7\4\3\0\2\4\1\40\14\0\17\4\1\0\4\4" + "\1\134\2\4\3\0\2\4\1\40\14\0\4\4\1\135"
|
||||
+ "\1\4\1\135\10\4\1\0\7\4\3\0\2\4\1\40" + "\14\0\4\4\1\104\12\4\1\0\7\4\3\0\2\4"
|
||||
+ "\1\40\14\0\10\4\1\136\6\4\1\0\7\4\3\0" + "\2\4\1\40\14\0\1\4\1\137\15\4\1\0\7\4"
|
||||
+ "\3\0\2\4\1\40\14\0\16\4\1\140\1\0\7\4" + "\3\0\2\4\1\40\14\0\4\4\1\141\12\4\1\0"
|
||||
+ "\7\4\3\0\2\4\1\40\14\0\4\4\1\135\12\4" + "\1\0\7\4\3\0\2\4\1\40\14\0\17\4\1\0"
|
||||
+ "\6\4\1\104\3\0\2\4\1\40\14\0\1\4\1\114" + "\2\4\1\115\12\4\1\0\7\4\3\0\2\4\1\40"
|
||||
+ "\14\0\5\4\1\142\11\4\1\0\7\4\3\0\2\4" + "\1\40\14\0\6\4\1\143\10\4\1\0\7\4\3\0"
|
||||
+ "\2\4\1\40\14\0\16\4\1\104\1\0\7\4\3\0" + "\2\4\1\40\14\0\15\4\1\144\1\4\1\0\7\4"
|
||||
+ "\3\0\2\4\1\40\14\0\4\4\1\145\12\4\1\0" + "\7\4\3\0\2\4\1\40\14\0\1\4\1\146\15\4"
|
||||
+ "\1\0\7\4\3\0\2\4\1\40\14\0\17\4\1\0" + "\1\4\1\74\5\4\3\0\2\4\1\40\14\0\1\4"
|
||||
+ "\1\147\15\4\1\0\7\4\3\0\2\4\1\40\14\0" + "\1\4\1\150\15\4\1\0\7\4\3\0\2\4\1\40"
|
||||
+ "\14\0\13\4\1\104\3\4\1\0\7\4\3\0\2\4" + "\1\40\14\0\3\4\1\151\13\4\1\0\7\4\3\0"
|
||||
+ "\2\4\1\40\14\0\11\4\1\63\5\4\1\0\7\4" + "\3\0\2\4\1\40\14\0\13\4\1\107\3\4\1\0"
|
||||
+ "\7\4\3\0\2\4\1\40\14\0\10\4\1\152\6\4" + "\1\0\7\4\3\0\2\4\1\40\14\0\5\4\1\104"
|
||||
+ "\11\4\1\0\7\4\3\0\2\4\1\40\14\0\16\4" + "\1\153\1\0\7\4\3\0\2\4\1\40\14\0\10\4"
|
||||
+ "\1\154\6\4\1\0\7\4\3\0\2\4\1\40\14\0" + "\4\4\1\155\12\4\1\0\7\4\3\0\2\4\1\40"
|
||||
+ "\14\0\1\156\16\4\1\0\7\4\3\0\2\4\1\40" + "\14\0\6\4\1\157\10\4\1\0\7\4\3\0\2\4"
|
||||
+ "\1\40\14\0\2\4\1\104\14\4\1\0\7\4\3\0" + "\2\4\1\40\14\0\15\4\1\104\1\4\1\0\7\4"
|
||||
+ "\3\0\2\4\1\40\14\0\13\4\1\160\3\4\1\0" + "\7\4\3\0\2\4\1\40\14\0\6\4\1\54\10\4"
|
||||
+ "\1\0\7\4\3\0\2\4\1\40\14\0\17\4\1\0" + "\3\4\1\161\3\4\3\0\2\4\1\40\14\0\10\4"
|
||||
+ "\1\104\6\4\1\0\7\4\3\0\2\4\1\40\14\0" + "\4\4\1\117\12\4\1\0\7\4\3\0\2\4\1\40"
|
||||
+ "\14\0\11\4\1\162\5\4\1\0\7\4\3\0\2\4" + "\1\40\14\0\17\4\1\0\2\4\1\163\4\4\3\0"
|
||||
+ "\2\4\1\40\14\0\16\4\1\164\1\0\7\4\3\0" + "\2\4\1\40\14\0\3\4\1\165\13\4\1\0\7\4"
|
||||
+ "\3\0\2\4\1\40\14\0\17\4\1\0\3\4\1\166" + "\3\4\3\0\2\4\1\40\14\0\7\4\1\104\7\4"
|
||||
+ "\1\0\7\4\3\0\2\4\1\40\14\0\1\167\16\4" + "\1\0\7\4\3\0\2\4\1\40\14\0\1\170\16\4"
|
||||
+ "\1\0\7\4\3\0\2\4\1\40\14\0\12\4\1\171" + "\4\4\1\0\7\4\3\0\2\4\1\40\14\0\17\4"
|
||||
+ "\1\0\1\170\6\4\3\0\2\4\1\40\14\0\3\4" + "\1\172\13\4\1\0\7\4\3\0\2\4\1\40\14\0"
|
||||
+ "\17\4\1\173\7\4\3\0\2\4\1\40\14\0\17\4" + "\1\0\4\4\1\104\2\4\3\0\2\4\1\40\14\0"
|
||||
+ "\14\4\1\107\2\4\1\0\7\4\3\0\2\4\1\40" + "\14\0\3\4\1\174\13\4\1\0\7\4\3\0\2\4"
|
||||
+ "\1\40\14\0\10\4\1\121\6\4\1\0\7\4\3\0" + "\2\4\1\40\14\0\6\4\1\175\10\4\1\0\7\4"
|
||||
+ "\42\0\1\176\11\0\2\4\1\40\14\0\1\4\1\104" + "\15\4\1\0\7\4\3\0\2\4\1\40\14\0\13\4"
|
||||
+ "\1\177\3\4\1\0\7\4\33\0\1\200\20\0\2\4" + "\1\40\14\0\17\4\1\0\1\4\1\104\5\4\40\0" + "\1\201\12\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[4551];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\4\1\1\11\5\1\1\11\17\1\6\11"
|
||||
+ "\2\1\1\11\2\0\1\11\23\1\2\11\74\1\1\0" + "\2\1\1\0\1\1\1\0\1\11";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[129];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
private Stack<Boolean> varDepths;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public MakefileTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether tokens of the specified type should have "mark occurrences"
|
||||
* enabled for the current programming language.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences" enabled.
|
||||
*/
|
||||
@Override
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type == Token.IDENTIFIER || type == Token.VARIABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(Token.NULL);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public MakefileTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public MakefileTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 126) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 13: {
|
||||
addToken(Token.PREPROCESSOR);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 15: {
|
||||
if (varDepths == null) {
|
||||
varDepths = new Stack<Boolean>();
|
||||
} else {
|
||||
varDepths.clear();
|
||||
}
|
||||
varDepths.push(Boolean.FALSE);
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(VAR);
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 3: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 16: {
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 12: {
|
||||
if (!varDepths.empty() && varDepths.peek() == Boolean.TRUE) {
|
||||
varDepths.pop();
|
||||
if (varDepths.empty()) {
|
||||
addToken(start, zzStartRead, Token.VARIABLE);
|
||||
yybegin(YYINITIAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 11: {
|
||||
if (!varDepths.empty() && varDepths.peek() == Boolean.FALSE) {
|
||||
varDepths.pop();
|
||||
if (varDepths.empty()) {
|
||||
addToken(start, zzStartRead, Token.VARIABLE);
|
||||
yybegin(YYINITIAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 21: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 20: {
|
||||
varDepths.push(Boolean.FALSE);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 18: {
|
||||
addToken(Token.LITERAL_BACKQUOTE);
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 19: {
|
||||
varDepths.push(Boolean.TRUE);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 33:
|
||||
break;
|
||||
case 14: {
|
||||
if (varDepths == null) {
|
||||
varDepths = new Stack<Boolean>();
|
||||
} else {
|
||||
varDepths.clear();
|
||||
}
|
||||
varDepths.push(Boolean.TRUE);
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(VAR);
|
||||
}
|
||||
case 34:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.ERROR_CHAR);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 35:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.ERROR_STRING_DOUBLE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 36:
|
||||
break;
|
||||
case 10: {
|
||||
int temp1 = zzStartRead;
|
||||
int temp2 = zzMarkedPos;
|
||||
addToken(start, zzStartRead - 1, Token.VARIABLE);
|
||||
addToken(temp1, temp2 - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 37:
|
||||
break;
|
||||
case 17: {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 38:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 39:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||
}
|
||||
case 40:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 41:
|
||||
break;
|
||||
case 9: {
|
||||
}
|
||||
case 42:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case VAR: {
|
||||
addToken(start, zzStartRead - 1, Token.VARIABLE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 130:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 131:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,813 +0,0 @@
|
||||
/*
|
||||
* 01/21/2011
|
||||
*
|
||||
* MxmlTokenMaker.java - Generates tokens for MXML syntax highlighting.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for MXML.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>MXMLTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class MxmlTokenMaker
|
||||
%extends AbstractMarkupTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Type specific to JSPTokenMaker denoting a line ending with an unclosed
|
||||
* double-quote attribute.
|
||||
*/
|
||||
public static final int INTERNAL_ATTR_DOUBLE = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Type specific to JSPTokenMaker denoting a line ending with an unclosed
|
||||
* single-quote attribute.
|
||||
*/
|
||||
public static final int INTERNAL_ATTR_SINGLE = -2;
|
||||
|
||||
|
||||
/**
|
||||
* Token type specific to this class; this signals that the user has
|
||||
* ended a line with an unclosed XML tag; thus a new line is beginning
|
||||
* still inside of the tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG = -3;
|
||||
|
||||
/**
|
||||
* Token type specific to this class; this signals that the user has
|
||||
* ended a line with an unclosed Script tag; thus a new line is beginning
|
||||
* still inside of the tag.
|
||||
*/
|
||||
public static final int INTERNAL_INTAG_SCRIPT = -4;
|
||||
|
||||
/**
|
||||
* Token type specific to this class; this signals that the user has
|
||||
* ended a line in the middle of a double-quoted attribute in a Script
|
||||
* tag.
|
||||
*/
|
||||
public static final int INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT = -5;
|
||||
|
||||
/**
|
||||
* Token type specific to this class; this signals that the user has
|
||||
* ended a line in the middle of a single-quoted attribute in a Script
|
||||
* tag.
|
||||
*/
|
||||
public static final int INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT = -6;
|
||||
|
||||
/**
|
||||
* Token type specific to this class; this signals that the user has
|
||||
* ended a line in an ActionScript code block (text content inside a
|
||||
* Script tag).
|
||||
*/
|
||||
public static final int INTERNAL_IN_AS = -7;
|
||||
|
||||
/**
|
||||
* Token type specific to this class; this signals that the user has
|
||||
* ended a line in an MLC in an ActionScript code block (text content
|
||||
* inside a Script tag).
|
||||
*/
|
||||
public static final int INTERNAL_IN_AS_MLC = -8;
|
||||
|
||||
/**
|
||||
* Whether closing markup tags are automatically completed for HTML.
|
||||
*/
|
||||
private static boolean completeCloseTags;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public MxmlTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
completeCloseTags = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether markup close tags should be completed. For XML, the
|
||||
* default value is <code>true</code>.
|
||||
*
|
||||
* @return Whether closing markup tags are completed.
|
||||
* @see #setCompleteCloseTags(boolean)
|
||||
*/
|
||||
@Override
|
||||
public boolean getCompleteCloseTags() {
|
||||
return completeCloseTags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Static version of {@link #getCompleteCloseTags()}. This hack is
|
||||
* unfortunately needed for applications to be able to query this value
|
||||
* without instantiating this class.
|
||||
*
|
||||
* @return Whether closing markup tags are completed.
|
||||
* @see #setCompleteCloseTags(boolean)
|
||||
*/
|
||||
public static boolean getCompleteCloseMarkupTags() {
|
||||
return completeCloseTags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Always returns <code>false</code>, as you never want "mark occurrences"
|
||||
* working in XML files.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences"
|
||||
* enabled.
|
||||
*/
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.MARKUP_COMMENT:
|
||||
state = COMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.MARKUP_DTD:
|
||||
state = DTD;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_ATTR_DOUBLE:
|
||||
state = INATTR_DOUBLE;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_ATTR_SINGLE:
|
||||
state = INATTR_SINGLE;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.MARKUP_PROCESSING_INSTRUCTION:
|
||||
state = PI;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_INTAG:
|
||||
state = INTAG;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_INTAG_SCRIPT:
|
||||
state = INTAG_SCRIPT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT:
|
||||
state = INATTR_DOUBLE_SCRIPT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT:
|
||||
state = INATTR_SINGLE_SCRIPT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_IN_AS:
|
||||
state = AS;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_IN_AS_MLC:
|
||||
state = AS_MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.MARKUP_CDATA:
|
||||
state = CDATA;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether markup close tags should be completed.
|
||||
*
|
||||
* @param complete Whether closing markup tags are completed.
|
||||
* @see #getCompleteCloseTags()
|
||||
*/
|
||||
public static void setCompleteCloseTags(boolean complete) {
|
||||
completeCloseTags = complete;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <code>YY_INITIAL</code>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
/* XML macros (and some building-block macros used by AS macros). */
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NameStartChar = ({Letter}|[\:])
|
||||
NameChar = ({NameStartChar}|[\-\.]|{Digit})
|
||||
TagName = ({NameStartChar}{NameChar}*)
|
||||
Whitespace = ([ \t\f])
|
||||
LineTerminator = ([\n])
|
||||
Identifier = ([^ \t\n<&]+)
|
||||
EntityReference = ([&][^; \t]*[;]?)
|
||||
InTagIdentifier = ([^ \t\n\"\'=\/>]+)
|
||||
CDataBegin = ("<![CDATA[")
|
||||
CDataEnd = ("]]>")
|
||||
|
||||
|
||||
/* ActionScript macros. */
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
AnyCharacterButApostropheOrBackSlash = ([^\\'])
|
||||
AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
AS_CharLiteral = ([\']({AnyCharacterButApostropheOrBackSlash}|{Escape})*[\'])
|
||||
AS_UnclosedCharLiteral = ([\']([\\].|[^\\\'])*[^\']?)
|
||||
AS_ErrorCharLiteral = ({AS_UnclosedCharLiteral}[\'])
|
||||
AS_StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"])
|
||||
AS_UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
AS_ErrorStringLiteral = ({AS_UnclosedStringLiteral}[\"])
|
||||
|
||||
AS_MLCBegin = ("/*")
|
||||
AS_MLCEnd = ("*/")
|
||||
AS_LineCommentBegin = ("//")
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
AS_IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
AS_HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
AS_FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
AS_ErrorNumberFormat = (({AS_IntegerLiteral}|{AS_HexLiteral}|{AS_FloatLiteral}){NonSeparator}+)
|
||||
AS_BooleanLiteral = ("true"|"false")
|
||||
|
||||
AS_Separator = ([\(\)\{\}\[\]])
|
||||
AS_Separator2 = ([\;,.])
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
AS_Operator = ({NonAssignmentOperator}|{AssignmentOperator})
|
||||
|
||||
AS_Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
AS_ErrorIdentifier = ({NonSeparator}+)
|
||||
AS_EndScriptTag = ("</"({NameStartChar}{NameChar}*":")?"Script"{Whitespace}*">")
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state COMMENT
|
||||
%state PI
|
||||
%state DTD
|
||||
%state INTAG
|
||||
%state INATTR_DOUBLE
|
||||
%state INATTR_SINGLE
|
||||
%state INTAG_SCRIPT
|
||||
%state INATTR_DOUBLE_SCRIPT
|
||||
%state INATTR_SINGLE_SCRIPT
|
||||
%state CDATA
|
||||
|
||||
%state AS
|
||||
%state AS_MLC
|
||||
%state AS_EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
"<!--" { start = zzMarkedPos-4; yybegin(COMMENT); }
|
||||
{CDataBegin} { addToken(Token.MARKUP_CDATA_DELIMITER); start = zzMarkedPos; yybegin(CDATA); }
|
||||
"<!" { start = zzMarkedPos-2; yybegin(DTD); }
|
||||
"<?" { start = zzMarkedPos-2; yybegin(PI); }
|
||||
"<"{TagName} {
|
||||
int count = yylength();
|
||||
String tag = yytext(); // Get before addToken calls
|
||||
addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-1), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
if (tag.endsWith(":Script") || tag.equals("<Script")) {
|
||||
yybegin(INTAG_SCRIPT);
|
||||
}
|
||||
else {
|
||||
yybegin(INTAG);
|
||||
}
|
||||
}
|
||||
"</"{TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-2), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(INTAG);
|
||||
}
|
||||
"<" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG); }
|
||||
"</" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(INTAG); }
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{EntityReference} { addToken(Token.MARKUP_ENTITY_REFERENCE); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<COMMENT> {
|
||||
[^hwf\n\-]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addHyperlinkToken(temp,zzMarkedPos-1, Token.MARKUP_COMMENT); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
"-->" { yybegin(YYINITIAL); addToken(start,zzStartRead+2, Token.MARKUP_COMMENT); }
|
||||
"-" {}
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); return firstToken; }
|
||||
}
|
||||
|
||||
<PI> {
|
||||
[^\n\?]+ {}
|
||||
{LineTerminator} { addToken(start,zzStartRead-1, Token.MARKUP_PROCESSING_INSTRUCTION); return firstToken; }
|
||||
"?>" { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.MARKUP_PROCESSING_INSTRUCTION); }
|
||||
"?" {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_PROCESSING_INSTRUCTION); return firstToken; }
|
||||
}
|
||||
|
||||
<DTD> {
|
||||
[^\n>]+ {}
|
||||
{LineTerminator} { addToken(start,zzStartRead-1, Token.MARKUP_DTD); return firstToken; }
|
||||
">" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.MARKUP_DTD); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_DTD); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG> {
|
||||
{InTagIdentifier} { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
"/" { addToken(Token.MARKUP_TAG_DELIMITER); /* Not valid but we'll still accept it */ }
|
||||
"/>" { yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
">" { yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
[\"] { start = zzMarkedPos-1; yybegin(INATTR_DOUBLE); }
|
||||
[\'] { start = zzMarkedPos-1; yybegin(INATTR_SINGLE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, INTERNAL_INTAG); return firstToken; }
|
||||
}
|
||||
|
||||
<INATTR_DOUBLE> {
|
||||
[^\"]* {}
|
||||
[\"] { yybegin(INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE); return firstToken; }
|
||||
}
|
||||
|
||||
<INATTR_SINGLE> {
|
||||
[^\']* {}
|
||||
[\'] { yybegin(INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE); return firstToken; }
|
||||
}
|
||||
|
||||
<INTAG_SCRIPT> {
|
||||
{InTagIdentifier} { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
"/" { addToken(Token.MARKUP_TAG_DELIMITER); /* Not valid but we'll still accept it */ }
|
||||
"/>" { yybegin(YYINITIAL); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
">" { yybegin(AS); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
[\"] { start = zzMarkedPos-1; yybegin(INATTR_DOUBLE_SCRIPT); }
|
||||
[\'] { start = zzMarkedPos-1; yybegin(INATTR_SINGLE_SCRIPT); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, INTERNAL_INTAG_SCRIPT); return firstToken; }
|
||||
}
|
||||
|
||||
<INATTR_DOUBLE_SCRIPT> {
|
||||
[^\"]* {}
|
||||
[\"] { yybegin(INTAG_SCRIPT); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_DOUBLE_QUOTE_SCRIPT); return firstToken; }
|
||||
}
|
||||
|
||||
<INATTR_SINGLE_SCRIPT> {
|
||||
[^\']* {}
|
||||
[\'] { yybegin(INTAG_SCRIPT); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_ATTR_SINGLE_QUOTE_SCRIPT); return firstToken; }
|
||||
}
|
||||
|
||||
<CDATA> {
|
||||
[^\]]+ {}
|
||||
{CDataEnd} { int temp=zzStartRead; yybegin(YYINITIAL); addToken(start,zzStartRead-1, Token.MARKUP_CDATA); addToken(temp,zzMarkedPos-1, Token.MARKUP_CDATA_DELIMITER); }
|
||||
"]" {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_CDATA); return firstToken; }
|
||||
}
|
||||
|
||||
<AS> {
|
||||
|
||||
{AS_EndScriptTag} {
|
||||
int origStart = zzStartRead;
|
||||
String text = yytext();
|
||||
int tagNameEnd = text.length() - 2; // "-1" is '>'
|
||||
while (Character.isWhitespace(text.charAt(tagNameEnd))) {
|
||||
tagNameEnd--;
|
||||
}
|
||||
int tagNameLen = tagNameEnd - 1;
|
||||
yybegin(YYINITIAL);
|
||||
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(origStart+2,origStart+2+tagNameLen-1, Token.MARKUP_TAG_NAME);
|
||||
if (tagNameEnd<text.length()-2) {
|
||||
addToken(origStart+tagNameEnd+1, zzMarkedPos-2, Token.WHITESPACE);
|
||||
}
|
||||
addToken(zzMarkedPos-1,zzMarkedPos-1, Token.MARKUP_TAG_DELIMITER);
|
||||
}
|
||||
|
||||
/* ActionScript snippets are usually wrapped in CDATA. */
|
||||
{CDataBegin} |
|
||||
{CDataEnd} { addToken(Token.MARKUP_CDATA_DELIMITER); }
|
||||
|
||||
/* Keywords */
|
||||
"add" |
|
||||
"and" |
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"const" |
|
||||
"continue" |
|
||||
"default" |
|
||||
"delete" |
|
||||
"do" |
|
||||
"dynamic" |
|
||||
"else" |
|
||||
"eq" |
|
||||
"extends" |
|
||||
"final" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"for each" |
|
||||
"function" |
|
||||
"ge" |
|
||||
"get" |
|
||||
"gt" |
|
||||
"if" |
|
||||
"ifFrameLoaded" |
|
||||
"implements" |
|
||||
"import" |
|
||||
"in" |
|
||||
"include" |
|
||||
"interface" |
|
||||
"internal" |
|
||||
"label" |
|
||||
"le" |
|
||||
"lt" |
|
||||
"namespace" |
|
||||
"native" |
|
||||
"ne" |
|
||||
"new" |
|
||||
"not" |
|
||||
"on" |
|
||||
"onClipEvent" |
|
||||
"or" |
|
||||
"override" |
|
||||
"package" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"return" |
|
||||
"set" |
|
||||
"static" |
|
||||
"super" |
|
||||
"switch" |
|
||||
"tellTarget" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try" |
|
||||
"typeof" |
|
||||
"use" |
|
||||
"var" |
|
||||
"void" |
|
||||
"while" |
|
||||
"with" |
|
||||
|
||||
"null" |
|
||||
"undefined" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Built-in objects (good idea not to use these names!) */
|
||||
"Array" |
|
||||
"Boolean" |
|
||||
"Color" |
|
||||
"Date" |
|
||||
"Function" |
|
||||
"int" |
|
||||
"Key" |
|
||||
"MovieClip" |
|
||||
"Math" |
|
||||
"Mouse" |
|
||||
"Null" |
|
||||
"Number" |
|
||||
"Object" |
|
||||
"Selection" |
|
||||
"Sound" |
|
||||
"String" |
|
||||
"uint" |
|
||||
"Vector" |
|
||||
"void" |
|
||||
"XML" |
|
||||
"XMLNode" |
|
||||
"XMLSocket" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Global functions */
|
||||
"call" |
|
||||
"escape" |
|
||||
"eval" |
|
||||
"fscommand" |
|
||||
"getProperty" |
|
||||
"getTimer" |
|
||||
"getURL" |
|
||||
"getVersion" |
|
||||
"gotoAndPlay" |
|
||||
"gotoAndStop" |
|
||||
"#include" |
|
||||
"int" |
|
||||
"isFinite" |
|
||||
"isNaN" |
|
||||
"loadMovie" |
|
||||
"loadMovieNum" |
|
||||
"loadVariables" |
|
||||
"loadVariablesNum" |
|
||||
"maxscroll" |
|
||||
"newline" |
|
||||
"nextFrame" |
|
||||
"nextScene" |
|
||||
"Number" |
|
||||
"parseFloat" |
|
||||
"parseInt" |
|
||||
"play" |
|
||||
"prevFrame" |
|
||||
"prevScene" |
|
||||
"print" |
|
||||
"printAsBitmap" |
|
||||
"printAsBitmapNum" |
|
||||
"printNum" |
|
||||
"random" |
|
||||
"removeMovieClip" |
|
||||
"scroll" |
|
||||
"setProperty" |
|
||||
"startDrag" |
|
||||
"stop" |
|
||||
"stopAllSounds" |
|
||||
"stopDrag" |
|
||||
"String" |
|
||||
"targetPath" |
|
||||
"tellTarget" |
|
||||
"toggleHighQuality" |
|
||||
"trace" |
|
||||
"unescape" |
|
||||
"unloadMovie" |
|
||||
"unloadMovieNum" |
|
||||
"updateAfterEvent" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Booleans. */
|
||||
{AS_BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{LineTerminator} { addEndToken(INTERNAL_IN_AS); return firstToken; }
|
||||
|
||||
{AS_Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{Whitespace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{AS_CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{AS_UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{AS_ErrorCharLiteral} { addToken(Token.ERROR_CHAR); }
|
||||
{AS_StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{AS_UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{AS_ErrorStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{AS_MLCBegin} { start = zzMarkedPos-2; yybegin(AS_MLC); }
|
||||
{AS_LineCommentBegin} { start = zzMarkedPos-2; yybegin(AS_EOL_COMMENT); }
|
||||
|
||||
/* Separators. */
|
||||
{AS_Separator} { addToken(Token.SEPARATOR); }
|
||||
{AS_Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{AS_Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{AS_IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{AS_HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{AS_FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{AS_ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{AS_ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addEndToken(INTERNAL_IN_AS); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<AS_MLC> {
|
||||
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_AS_MLC); return firstToken; }
|
||||
{AS_MLCEnd} { yybegin(AS); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_AS_MLC); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<AS_EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addEndToken(INTERNAL_IN_AS); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,742 +0,0 @@
|
||||
/*
|
||||
* 07/14/2014
|
||||
*
|
||||
* NSISTokenMaker.java - Scanner for NSIS installer scripts.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for NSIS installer scripts.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>NSISTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class NSISTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public NSISTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR_LITERAL;
|
||||
break;
|
||||
case Token.LITERAL_BACKQUOTE:
|
||||
state = BACKTICKS;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
break;
|
||||
}
|
||||
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = ([A-Za-z])
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = ([1-9])
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|[$/])
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
MLCBegin = ("/*")
|
||||
MLCEnd = ("*/")
|
||||
LineCommentBegin = ([;#])
|
||||
|
||||
IntegerLiteral = (({NonzeroDigit}{Digit}*)|"0")
|
||||
HexLiteral = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}){NonSeparator}+)
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>=")
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator})
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
VariableStart = ("$")
|
||||
Variable = ({VariableStart}({Identifier}|"{"{Identifier}"}"))
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state STRING
|
||||
%state CHAR_LITERAL
|
||||
%state BACKTICKS
|
||||
%state MLC
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"function" |
|
||||
"functionend" |
|
||||
"section" |
|
||||
"sectionend" |
|
||||
"subsection" |
|
||||
"subsectionend" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Instructions */
|
||||
"addbrandingimage" |
|
||||
"addsize" |
|
||||
"allowrootdirinstall" |
|
||||
"allowskipfiles" |
|
||||
"autoclosewindow" |
|
||||
"bggradient" |
|
||||
"brandingtext" |
|
||||
"bringtofront" |
|
||||
"callinstdll" |
|
||||
"caption" |
|
||||
"changeui" |
|
||||
"checkbitmap" |
|
||||
"completedtext" |
|
||||
"componenttext" |
|
||||
"copyfiles" |
|
||||
"crccheck" |
|
||||
"createdirectory" |
|
||||
"createfont" |
|
||||
"createshortcut" |
|
||||
"delete" |
|
||||
"deleteinisec" |
|
||||
"deleteinistr" |
|
||||
"deleteregkey" |
|
||||
"deleteregvalue" |
|
||||
"detailprint" |
|
||||
"detailsbuttontext" |
|
||||
"dirshow" |
|
||||
"dirtext" |
|
||||
"enumregkey" |
|
||||
"enumregvalue" |
|
||||
"exch" |
|
||||
"exec" |
|
||||
"execshell" |
|
||||
"execwait" |
|
||||
"expandenvstrings" |
|
||||
"file" |
|
||||
"fileclose" |
|
||||
"fileerrortext" |
|
||||
"fileopen" |
|
||||
"fileread" |
|
||||
"filereadbyte" |
|
||||
"fileseek" |
|
||||
"filewrite" |
|
||||
"filewritebyte" |
|
||||
"findclose" |
|
||||
"findfirst" |
|
||||
"findnext" |
|
||||
"findwindow" |
|
||||
"flushini" |
|
||||
"getcurinsttype" |
|
||||
"getcurrentaddress" |
|
||||
"getdlgitem" |
|
||||
"getdllversion" |
|
||||
"getdllversionlocal" |
|
||||
"getfiletime" |
|
||||
"getfiletimelocal" |
|
||||
"getfullpathname" |
|
||||
"getfunctionaddress" |
|
||||
"getlabeladdress" |
|
||||
"gettempfilename" |
|
||||
"getwindowtext" |
|
||||
"hidewindow" |
|
||||
"icon" |
|
||||
"initpluginsdir" |
|
||||
"installbuttontext" |
|
||||
"installcolors" |
|
||||
"installdir" |
|
||||
"installdirregkey" |
|
||||
"instprogressflags" |
|
||||
"insttype" |
|
||||
"insttypegettext" |
|
||||
"insttypesettext" |
|
||||
"intfmt" |
|
||||
"intop" |
|
||||
"langstring" |
|
||||
"langstringup" |
|
||||
"licensebkcolor" |
|
||||
"licensedata" |
|
||||
"licenseforceselection" |
|
||||
"licensetext" |
|
||||
"loadlanguagefile" |
|
||||
"loadlanguagefile" |
|
||||
"logset" |
|
||||
"logtext" |
|
||||
"miscbuttontext" |
|
||||
"name" |
|
||||
"nop" |
|
||||
"outfile" |
|
||||
"page" |
|
||||
"plugindir" |
|
||||
"pop" |
|
||||
"push" |
|
||||
"readenvstr" |
|
||||
"readinistr" |
|
||||
"readregdword" |
|
||||
"readregstr" |
|
||||
"regdll" |
|
||||
"rename" |
|
||||
"requestexecutionlevel" |
|
||||
"reservefile" |
|
||||
"rmdir" |
|
||||
"searchpath" |
|
||||
"sectiongetflags" |
|
||||
"sectiongetinsttypes" |
|
||||
"sectiongetsize" |
|
||||
"sectiongettext" |
|
||||
"sectionin" |
|
||||
"sectionsetflags" |
|
||||
"sectionsetinsttypes" |
|
||||
"sectionsetsize" |
|
||||
"sectionsettext" |
|
||||
"sendmessage" |
|
||||
"setautoclose" |
|
||||
"setbkcolor" |
|
||||
"setbrandingimage" |
|
||||
"setcompress" |
|
||||
"setcompressor" |
|
||||
"setcurinsttype" |
|
||||
"setdatablockoptimize" |
|
||||
"setdatesave" |
|
||||
"setdetailsprint" |
|
||||
"setdetailsview" |
|
||||
"setfileattributes" |
|
||||
"setfont" |
|
||||
"setoutpath" |
|
||||
"setoverwrite" |
|
||||
"setpluginunload" |
|
||||
"setrebootflag" |
|
||||
"setshellvarcontext" |
|
||||
"setstaticbkcolor" |
|
||||
"setwindowlong" |
|
||||
"showinstdetails" |
|
||||
"showuninstdetails" |
|
||||
"showwindow" |
|
||||
"silentinstall" |
|
||||
"silentuninstall" |
|
||||
"sleep" |
|
||||
"spacetexts" |
|
||||
"strcpy" |
|
||||
"strlen" |
|
||||
"subcaption" |
|
||||
"uninstallbuttontext" |
|
||||
"uninstallcaption" |
|
||||
"uninstallicon" |
|
||||
"uninstallsubcaption" |
|
||||
"uninstalltext" |
|
||||
"uninstpage" |
|
||||
"unregdll" |
|
||||
"var" |
|
||||
"viaddversionkey" |
|
||||
"videscription" |
|
||||
"vicompanyname" |
|
||||
"vicomments" |
|
||||
"vilegalcopyrights" |
|
||||
"vilegaltrademarks" |
|
||||
"viproductname" |
|
||||
"viproductversion" |
|
||||
"windowicon" |
|
||||
"writeinistr" |
|
||||
"writeregbin" |
|
||||
"writeregdword" |
|
||||
"writeregexpandstr" |
|
||||
"writeregstr" |
|
||||
"writeuninstaller" |
|
||||
"xpstyle" |
|
||||
|
||||
/* Flow control instructions */
|
||||
"abort" |
|
||||
"call" |
|
||||
"clearerrors" |
|
||||
"goto" |
|
||||
"ifabort" |
|
||||
"iferrors" |
|
||||
"iffileexists" |
|
||||
"ifrebootflag" |
|
||||
"intcmp" |
|
||||
"intcmpu" |
|
||||
"iswindow" |
|
||||
"messagebox" |
|
||||
"reboot" |
|
||||
"return" |
|
||||
"quit" |
|
||||
"seterrors" |
|
||||
"strcmp" |
|
||||
"strcmps" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* Compiler utility commands */
|
||||
"!addincludedir" |
|
||||
"!addplugindir" |
|
||||
"!define" |
|
||||
"!include" |
|
||||
"!cd" |
|
||||
"!echo" |
|
||||
"!error" |
|
||||
"!insertmacro" |
|
||||
"!packhdr" |
|
||||
"!system" |
|
||||
"!warning" |
|
||||
"!undef" |
|
||||
"!verbose" |
|
||||
|
||||
/* Conditional compilation */
|
||||
"!ifdef" |
|
||||
"!ifndef" |
|
||||
"!if" |
|
||||
"!else" |
|
||||
"!endif" |
|
||||
"!macro" |
|
||||
"!macroend" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Global variables */
|
||||
"$0" |
|
||||
"$1" |
|
||||
"$2" |
|
||||
"$3" |
|
||||
"$4" |
|
||||
"$5" |
|
||||
"$6" |
|
||||
"$7" |
|
||||
"$8" |
|
||||
"$9" |
|
||||
"$INSTDIR" |
|
||||
"$OUTDIR" |
|
||||
"$CMDLINE" |
|
||||
"$LANGUAGE" |
|
||||
|
||||
/* Local variables */
|
||||
("$R0"{Digit}) |
|
||||
|
||||
/* Constants */
|
||||
"ARCHIVE" |
|
||||
"CENTER" |
|
||||
"CONTROL" |
|
||||
"CUR" |
|
||||
"EXT" |
|
||||
("F"{NonzeroDigit}) |
|
||||
("F1"{Digit}) |
|
||||
("F2"[0-4]) |
|
||||
"FILE_ATTRIBUTE_ARCHIVE" |
|
||||
"MB_ABORTRETRYIGNORE" |
|
||||
"RIGHT" |
|
||||
"RO" |
|
||||
"SET" |
|
||||
"SHIFT" |
|
||||
"SW_SHOWMAXIMIZED" |
|
||||
"SW_SHOWMINIMIZED" |
|
||||
"SW_SHOWNORMAL" |
|
||||
"a" |
|
||||
"admin" |
|
||||
"all" |
|
||||
"alwaysoff" |
|
||||
"auto" |
|
||||
"both" |
|
||||
"bottom" |
|
||||
"bzip2" |
|
||||
"checkbox" |
|
||||
"colored" |
|
||||
"components" |
|
||||
"current" |
|
||||
"custom" |
|
||||
"directory" |
|
||||
"force" |
|
||||
"hide" |
|
||||
"highest" |
|
||||
"ifnewer" |
|
||||
"instfiles" |
|
||||
"license" |
|
||||
"listonly" |
|
||||
"manual" |
|
||||
"nevershow" |
|
||||
"none" |
|
||||
"off" |
|
||||
"on" |
|
||||
"r" |
|
||||
"radiobuttons" |
|
||||
"show" |
|
||||
"silent" |
|
||||
"silentlog" |
|
||||
"smooth" |
|
||||
"textonly" |
|
||||
"top" |
|
||||
"try" |
|
||||
"uninstConfirm" |
|
||||
"user" |
|
||||
"w" |
|
||||
"zlib" |
|
||||
"$$" |
|
||||
"$DESKTOP" |
|
||||
"$EXEDIR" |
|
||||
"$HWNDPARENT" |
|
||||
"$PLUGINSDIR" |
|
||||
"$PROGRAMFILES" |
|
||||
"$QUICKLAUNCH" |
|
||||
"$SMPROGRAMS" |
|
||||
"$SMSTARTUP" |
|
||||
"$STARTMENU" |
|
||||
"$SYSDIR" |
|
||||
"$TEMP" |
|
||||
"$WINDIR" |
|
||||
"$\n" |
|
||||
"$\r" |
|
||||
"${NSISDIR}" |
|
||||
"ALT" |
|
||||
"END" |
|
||||
"FILE_ATTRIBUTE_HIDDEN" |
|
||||
"FILE_ATTRIBUTE_NORMAL" |
|
||||
"FILE_ATTRIBUTE_OFFLINE" |
|
||||
"FILE_ATTRIBUTE_READONLY" |
|
||||
"FILE_ATTRIBUTE_SYSTEM" |
|
||||
"FILE_ATTRIBUTE_TEMPORARY" |
|
||||
"HIDDEN" |
|
||||
"HKCC" |
|
||||
"HKCR" |
|
||||
"HKCU" |
|
||||
"HKDD" |
|
||||
"HKLM" |
|
||||
"HKPD" |
|
||||
"HKU" |
|
||||
"SHCTX" |
|
||||
"IDABORT" |
|
||||
"IDCANCEL" |
|
||||
"IDIGNORE" |
|
||||
"IDNO" |
|
||||
"IDOK" |
|
||||
"IDRETRY" |
|
||||
"IDYES" |
|
||||
"LEFT" |
|
||||
"MB_DEFBUTTON1" |
|
||||
"MB_DEFBUTTON2" |
|
||||
"MB_DEFBUTTON3" |
|
||||
"MB_DEFBUTTON4" |
|
||||
"MB_ICONEXCLAMATION" |
|
||||
"MB_ICONINFORMATION" |
|
||||
"MB_ICONQUESTION" |
|
||||
"MB_ICONSTOP" |
|
||||
"MB_OK" |
|
||||
"MB_OKCANCEL" |
|
||||
"MB_RETRYCANCEL" |
|
||||
"MB_RIGHT" |
|
||||
"MB_SETFOREGROUND" |
|
||||
"MB_TOPMOST" |
|
||||
"MB_YESNO" |
|
||||
"MB_YESNOCANCEL" |
|
||||
"NORMAL" |
|
||||
"OFFLINE" |
|
||||
"READONLY" |
|
||||
"SYSTEM" |
|
||||
"TEMPORARY" { addToken(Token.VARIABLE); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Variable} { addToken(Token.VARIABLE); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
\" { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
\' { start = zzMarkedPos-1; yybegin(CHAR_LITERAL); }
|
||||
\` { start = zzMarkedPos-1; yybegin(BACKTICKS); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as identifiers. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<STRING> {
|
||||
[^\n\\\$\"]+ {}
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<CHAR_LITERAL> {
|
||||
[^\n\\\$\']+ {}
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
addToken(start,zzStartRead, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\' { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_CHAR); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<BACKTICKS> {
|
||||
[^\n\\\$\`]+ {}
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
addToken(start,zzStartRead, Token.LITERAL_BACKQUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\` { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_BACKQUOTE); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<MLC> {
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,808 +0,0 @@
|
||||
/*
|
||||
* 01/26/2008
|
||||
*
|
||||
* PerlTokenMaker.java - Scanner for Perl
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for Perl.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>PerlTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class PerlTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specific to PerlTokenMaker; this signals that we are inside
|
||||
* an unquoted/double quoted/backtick EOF heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOF_UNQUOTED = -1;
|
||||
|
||||
/**
|
||||
* Token type specific to PerlTokenMaker; this signals that we are inside
|
||||
* an single quoted EOF heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOF_SINGLE_QUOTED = -2;
|
||||
|
||||
/**
|
||||
* Token type specific to PerlTokenMaker; this signals that we are inside
|
||||
* an unquoted/double quoted/backtick EOT heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOT_UNQUOTED = -3;
|
||||
|
||||
/**
|
||||
* Token type specific to PerlTokenMaker; this signals that we are inside
|
||||
* an single quoted EOT heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOT_SINGLE_QUOTED = -4;
|
||||
|
||||
/**
|
||||
* Token type specific to PerlTokenMaker; this signals we are in a POD
|
||||
* block.
|
||||
*/
|
||||
public static final int INTERNAL_POD = -5;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public PerlTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return super.getMarkOccurrencesOfTokenType(type) || type==Token.VARIABLE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR_LITERAL;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_BACKQUOTE:
|
||||
state = BACKTICKS;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOF_UNQUOTED:
|
||||
state = HEREDOC_EOF_UNQUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOF_SINGLE_QUOTED:
|
||||
state = HEREDOC_EOF_SINGLE_QUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOT_UNQUOTED:
|
||||
state = HEREDOC_EOT_UNQUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOT_SINGLE_QUOTED:
|
||||
state = HEREDOC_EOT_SINGLE_QUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_POD:
|
||||
state = POD;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether a regular expression token can follow the specified
|
||||
* token.
|
||||
*
|
||||
* @param t The token to check, which may be <code>null</code>.
|
||||
* @return Whether a regular expression token may follow this one.
|
||||
*/
|
||||
private static final boolean regexCanFollow(Token t) {
|
||||
char ch;
|
||||
// We basically try to mimic Eclipse's JS editor's behavior here.
|
||||
return t==null ||
|
||||
//t.isOperator() ||
|
||||
(t.length()==1 && (
|
||||
(ch=t.charAt(0))=='=' ||
|
||||
ch=='(' ||
|
||||
ch==',' ||
|
||||
ch=='?' ||
|
||||
ch==':' ||
|
||||
ch=='[' ||
|
||||
ch=='!' ||
|
||||
ch=='&'
|
||||
)) ||
|
||||
/* Operators "==", "===", "!=", "!==", etc. */
|
||||
(t.getType()==Token.OPERATOR &&
|
||||
((ch=t.charAt(t.length()-1))=='=' || ch=='~'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
/*Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)))*/
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'\`]|"#"|"\\")
|
||||
IdentifierStart = ({Letter}|"_")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit})
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
LineCommentBegin = "#"
|
||||
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
Separator2 = ([\;:,.])
|
||||
|
||||
VariableStart = ([\$\@\%)]"$"?)
|
||||
BracedVariable = ({VariableStart}\{{Identifier}\})
|
||||
UnbracedVariable = ({VariableStart}{Identifier})
|
||||
BracedShellVariable = ([\$]\{[\&\`\'\+\*\.\/\|\,\\\"\;\#\%\=\-\~\^\:\?\!\@\$\<\>\)\(\[\]\)\}])
|
||||
UnbracedShellVariable = ([\$][\&\`\'\+\*\.\/\|\,\\\"\;\#\%\=\-\~\^\:\?\!\@\$\<\>\)\(\[\]\)])
|
||||
MatchVariable = ([\$]{Digit})
|
||||
Variable = ({BracedVariable}|{UnbracedVariable}|{BracedShellVariable}|{UnbracedShellVariable}|{MatchVariable})
|
||||
Regex = ("/"([^\*\\/]|\\.)([^/\\]|\\.)*"/"[msixpogcadlu]*)
|
||||
|
||||
NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>"|"->")
|
||||
AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
BindingOperator = ("=~"|"!~")
|
||||
FunnyOperator = (([\*][\'\"])|([\&][\'\"]))
|
||||
Operator = ({NonAssignmentOperator}|{AssignmentOperator}|{BindingOperator}|{FunnyOperator})
|
||||
|
||||
PodCommandsExceptCut = ("="("pod"|"head1"|"head2"|"head3"|"head4"|"over"|"item"|"back"|"begin"|"end"|"for"|"encoding"))
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
|
||||
%state STRING
|
||||
%state CHAR_LITERAL
|
||||
%state BACKTICKS
|
||||
%state HEREDOC_EOF_UNQUOTED
|
||||
%state HEREDOC_EOF_SINGLE_QUOTED
|
||||
%state HEREDOC_EOT_UNQUOTED
|
||||
%state HEREDOC_EOT_SINGLE_QUOTED
|
||||
%state POD
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"and" |
|
||||
"cmp" |
|
||||
"continue" |
|
||||
"do" |
|
||||
"else" |
|
||||
"elsif" |
|
||||
"eq" |
|
||||
"esac" |
|
||||
"for" |
|
||||
"foreach" |
|
||||
"ge" |
|
||||
"if" |
|
||||
"last" |
|
||||
"le" |
|
||||
"ne" |
|
||||
"next" |
|
||||
"not" |
|
||||
"or" |
|
||||
"redo" |
|
||||
"sub" |
|
||||
"unless" |
|
||||
"until" |
|
||||
"while" |
|
||||
"xor" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Standard Functions */
|
||||
"abs" |
|
||||
"accept" |
|
||||
"alarm" |
|
||||
"atan2" |
|
||||
"bind" |
|
||||
"binmode" |
|
||||
"bless" |
|
||||
"caller" |
|
||||
"chdir" |
|
||||
"chmod" |
|
||||
"chomp" |
|
||||
"chop" |
|
||||
"chown" |
|
||||
"chr" |
|
||||
"chroot" |
|
||||
"close" |
|
||||
"closedir" |
|
||||
"connect" |
|
||||
"cos" |
|
||||
"crypt" |
|
||||
"dbmclose" |
|
||||
"dbmopen" |
|
||||
"defined" |
|
||||
"delete" |
|
||||
"die" |
|
||||
"dump" |
|
||||
"each" |
|
||||
"endgrent" |
|
||||
"endhostent" |
|
||||
"endnetent" |
|
||||
"endprotoent" |
|
||||
"endpwent" |
|
||||
"endservent" |
|
||||
"eof" |
|
||||
"eval" |
|
||||
"exec" |
|
||||
"exists" |
|
||||
"exit" |
|
||||
"exp" |
|
||||
"fcntl" |
|
||||
"fileno" |
|
||||
"flock" |
|
||||
"fork" |
|
||||
"formline" |
|
||||
"getc" |
|
||||
"getgrent" |
|
||||
"getgrgid" |
|
||||
"getgrnam" |
|
||||
"gethostbyaddr" |
|
||||
"gethostbyname" |
|
||||
"gethostent" |
|
||||
"getlogin" |
|
||||
"getnetbyaddr" |
|
||||
"getnetbyname" |
|
||||
"getnetent" |
|
||||
"getpeername" |
|
||||
"getpgrp" |
|
||||
"getppid" |
|
||||
"getpriority" |
|
||||
"getprotobyname" |
|
||||
"getprotobynumber" |
|
||||
"getprotoent" |
|
||||
"getpwent" |
|
||||
"getpwnam" |
|
||||
"getpwuid" |
|
||||
"getservbyname" |
|
||||
"getservbyport" |
|
||||
"getservent" |
|
||||
"getsockname" |
|
||||
"getsockopt" |
|
||||
"glob" |
|
||||
"gmtime" |
|
||||
"goto" |
|
||||
"grep" |
|
||||
"hex" |
|
||||
"index" |
|
||||
"int" |
|
||||
"ioctl" |
|
||||
"join" |
|
||||
"keys" |
|
||||
"kill" |
|
||||
"last" |
|
||||
"lc" |
|
||||
"lcfirst" |
|
||||
"length" |
|
||||
"link" |
|
||||
"listen" |
|
||||
"local" |
|
||||
"localtime" |
|
||||
"log" |
|
||||
"lstat" |
|
||||
"map" |
|
||||
"mkdir" |
|
||||
"msgctl" |
|
||||
"msgget" |
|
||||
"msgrcv" |
|
||||
"msgsnd" |
|
||||
"my" |
|
||||
"next" |
|
||||
"no" |
|
||||
"oct" |
|
||||
"open" |
|
||||
"opendir" |
|
||||
"ord" |
|
||||
"our" |
|
||||
"pack" |
|
||||
"package" |
|
||||
"pipe" |
|
||||
"pop" |
|
||||
"pos" |
|
||||
"print" |
|
||||
"printf" |
|
||||
"prototype" |
|
||||
"push" |
|
||||
"quotemeta" |
|
||||
"rand" |
|
||||
"read" |
|
||||
"readdir" |
|
||||
"readline" |
|
||||
"readlink" |
|
||||
"readpipe" |
|
||||
"recv" |
|
||||
"redo" |
|
||||
"ref" |
|
||||
"rename" |
|
||||
"require" |
|
||||
"reset" |
|
||||
"return" |
|
||||
"reverse" |
|
||||
"rewinddir" |
|
||||
"rindex" |
|
||||
"rmdir" |
|
||||
"scalar" |
|
||||
"seek" |
|
||||
"seekdir" |
|
||||
"select" |
|
||||
"semctl" |
|
||||
"semget" |
|
||||
"semop" |
|
||||
"send" |
|
||||
"sethostent" |
|
||||
"setgrent" |
|
||||
"setnetent" |
|
||||
"setpgrp" |
|
||||
"setpriority" |
|
||||
"setprotoent" |
|
||||
"setpwent" |
|
||||
"setservent" |
|
||||
"setsockopt" |
|
||||
"shift" |
|
||||
"shmctl" |
|
||||
"shmget" |
|
||||
"shmread" |
|
||||
"shmwrite" |
|
||||
"shutdown" |
|
||||
"sin" |
|
||||
"sleep" |
|
||||
"socket" |
|
||||
"socketpair" |
|
||||
"sort" |
|
||||
"splice" |
|
||||
"split" |
|
||||
"sprintf" |
|
||||
"sqrt" |
|
||||
"srand" |
|
||||
"stat" |
|
||||
"study" |
|
||||
"sub" |
|
||||
"substr" |
|
||||
"symlink" |
|
||||
"syscall" |
|
||||
"sysopen" |
|
||||
"sysread" |
|
||||
"sysseek" |
|
||||
"system" |
|
||||
"syswrite" |
|
||||
"tell" |
|
||||
"telldir" |
|
||||
"tie" |
|
||||
"tied" |
|
||||
"time" |
|
||||
"times" |
|
||||
"truncate" |
|
||||
"uc" |
|
||||
"ucfirst" |
|
||||
"umask" |
|
||||
"undef" |
|
||||
"unlink" |
|
||||
"unpack" |
|
||||
"unshift" |
|
||||
"untie" |
|
||||
"use" |
|
||||
"utime" |
|
||||
"values" |
|
||||
"vec" |
|
||||
"wait" |
|
||||
"waitpid" |
|
||||
"wantarray" |
|
||||
"warn" |
|
||||
"write" { addToken(Token.FUNCTION); }
|
||||
|
||||
}
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
{Variable} { addToken(Token.VARIABLE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
\" { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
\' { start = zzMarkedPos-1; yybegin(CHAR_LITERAL); }
|
||||
\` { start = zzMarkedPos-1; yybegin(BACKTICKS); }
|
||||
|
||||
/* Comment literals. */
|
||||
{LineCommentBegin}"!".* { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; }
|
||||
{LineCommentBegin}.* { addToken(Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
/* Easily identifiable regexes of the form "/.../". This is not foolproof. */
|
||||
{Regex} {
|
||||
boolean highlightedAsRegex = false;
|
||||
if (firstToken==null) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
else {
|
||||
// If this is *likely* to be a regex, based on
|
||||
// the previous token, highlight it as such.
|
||||
Token t = firstToken.getLastNonCommentNonWhitespaceToken();
|
||||
if (regexCanFollow(t)) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
}
|
||||
// If it doesn't *appear* to be a regex, highlight it as
|
||||
// individual tokens.
|
||||
if (!highlightedAsRegex) {
|
||||
int temp = zzStartRead + 1;
|
||||
addToken(zzStartRead, zzStartRead, Token.OPERATOR);
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* More regexes (m/.../, s!...!!, etc.). This is nowhere near */
|
||||
/* exhaustive, but is rather just the common ones. */
|
||||
m"/"[^/]*"/"[msixpodualgc]* { addToken(Token.REGEX); }
|
||||
m"!"[^!]*"!"[msixpodualgc]* { addToken(Token.REGEX); }
|
||||
m"|"[^\|]*"|"[msixpodualgc]* { addToken(Token.REGEX); }
|
||||
m\\[^\\]*\\[msixpodualgc]* { addToken(Token.REGEX); }
|
||||
s"/"[^/]*"/"[^/]*"/"[msixpodualgcer]* { addToken(Token.REGEX); }
|
||||
s"!"[^!]*"!"[^!]*"!"[msixpodualgcer]* { addToken(Token.REGEX); }
|
||||
s"|"[^\|]*"|"[^\|]*"|"[msixpodualgcer]* { addToken(Token.REGEX); }
|
||||
(tr|y)"/"[^/]*"/"[^/]*"/"[cdsr]* { addToken(Token.REGEX); }
|
||||
(tr|y)"!"[^!]*"!"[^!]*"!"[cdsr]* { addToken(Token.REGEX); }
|
||||
(tr|y)"|"[^\|]*"|"[^\|]*"|"[cdsr]* { addToken(Token.REGEX); }
|
||||
(tr|y)\\[^\\]*\\[^\\]*\\[cdsr]* { addToken(Token.REGEX); }
|
||||
qr"/"[^/]*"/"[msixpodual]* { addToken(Token.REGEX); }
|
||||
qr"!"[^/]*"!"[msixpodual]* { addToken(Token.REGEX); }
|
||||
qr"|"[^/]*"|"[msixpodual]* { addToken(Token.REGEX); }
|
||||
qr\\[^/]*\\[msixpodual]* { addToken(Token.REGEX); }
|
||||
|
||||
/* "Here-document" syntax. This is only implemented for the common */
|
||||
/* cases. */
|
||||
"<<EOF" { start = zzStartRead; yybegin(HEREDOC_EOF_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \""EOF"\" { start = zzStartRead; yybegin(HEREDOC_EOF_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \'"EOF"\' { start = zzStartRead; yybegin(HEREDOC_EOF_SINGLE_QUOTED); }
|
||||
"<<" {WhiteSpace}* \`"EOF"\` { start = zzStartRead; yybegin(HEREDOC_EOF_UNQUOTED); }
|
||||
"<<EOT" { start = zzStartRead; yybegin(HEREDOC_EOT_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \""EOT"\" { start = zzStartRead; yybegin(HEREDOC_EOT_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \'"EOT"\' { start = zzStartRead; yybegin(HEREDOC_EOT_SINGLE_QUOTED); }
|
||||
"<<" {WhiteSpace}* \`"EOT"\` { start = zzStartRead; yybegin(HEREDOC_EOT_UNQUOTED); }
|
||||
|
||||
/* POD commands. */
|
||||
{PodCommandsExceptCut} { addToken(Token.COMMENT_EOL); start = zzMarkedPos; yybegin(POD); }
|
||||
|
||||
/* Separators and operators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<STRING> {
|
||||
[^\n\\\$\@\%\"]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<CHAR_LITERAL> {
|
||||
[^\n\\\']+ {}
|
||||
\\.? { /* Skip escaped single quotes only, but this should still work. */ }
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
\' { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<BACKTICKS> {
|
||||
[^\n\\\$\@\%\`]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
\` { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_BACKQUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOF_UNQUOTED> {
|
||||
/* NOTE: The closing "EOF" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOF"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOF" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
/* NOTE2: This case is used for unquoted <<EOF, double quoted */
|
||||
/* <<"EOF" and backticks <<`EOF`, since they all follow the same */
|
||||
/* syntactic rules. */
|
||||
"EOF" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\\$\@\%]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_UNQUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.PREPROCESSOR); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_UNQUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOF_SINGLE_QUOTED> {
|
||||
/* NOTE: The closing "EOF" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOF"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOF" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
"EOF" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_SINGLE_QUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_SINGLE_QUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOT_UNQUOTED> {
|
||||
/* NOTE: The closing "EOT" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOT"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOT" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
/* NOTE2: This case is used for unquoted <<EOT, double quoted */
|
||||
/* <<"EOT" and backticks <<`EOT`, since they all follow the same */
|
||||
/* syntactic rules. */
|
||||
"EOT" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\\$\@\%]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_UNQUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
{Variable} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.PREPROCESSOR); addToken(temp,zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
{VariableStart} {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_UNQUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOT_SINGLE_QUOTED> {
|
||||
/* NOTE: The closing "EOT" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOT"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOT" will match any line containing */
|
||||
/* EOT and any other chars. */
|
||||
"EOT" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_SINGLE_QUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_SINGLE_QUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<POD> {
|
||||
[^\n\=]+ {}
|
||||
"=cut" { if (start==zzStartRead) { addToken(Token.COMMENT_DOCUMENTATION); yybegin(YYINITIAL); } }
|
||||
{PodCommandsExceptCut} { if (start==zzStartRead) { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; } }
|
||||
= {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addEndToken(INTERNAL_POD); return firstToken; }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* 03/21/2005
|
||||
*
|
||||
* PropertiesFileTokenMaker.java - Scanner for properties files.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class splits up text into tokens representing a Java properties file.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>PropertiesFileTokenMaker.java</code> file will
|
||||
* contain two definitions of both <code>zzRefill</code> and
|
||||
* <code>yyreset</code>. You should hand-delete the second of each
|
||||
* definition (the ones generated by the lexer), as these generated
|
||||
* methods modify the input buffer, which we'll never have to do.
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class PropertiesFileTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public PropertiesFileTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = VALUE;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
* @exception IOException if any I/O-Error occurs.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Equals = ([=\:])
|
||||
Name = ([^=\: \t\n#!]*)
|
||||
Whitespace = ([ \t]+)
|
||||
Comment = ([#!].*)
|
||||
SingleQuote = (')
|
||||
|
||||
%state VALUE
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
{Name} { addToken(Token.RESERVED_WORD); }
|
||||
{Equals} { start = zzMarkedPos; addToken(Token.OPERATOR); yybegin(VALUE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{Comment} { addToken(Token.COMMENT_EOL); }
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<VALUE> {
|
||||
{SingleQuote}[^']*{SingleQuote}? { addToken(start, zzMarkedPos-1, Token.LITERAL_STRING_DOUBLE_QUOTE); start = zzMarkedPos; }
|
||||
[^'\{\\]+ {}
|
||||
"{"[^\}]*"}"? { int temp=zzStartRead; addToken(start, zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addToken(temp, zzMarkedPos-1, Token.VARIABLE); start = zzMarkedPos; }
|
||||
[\\]. {}
|
||||
[\\] { addToken(start, zzEndRead, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,610 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 1/28/11 4:16 PM */
|
||||
/*
|
||||
* 03/21/2005
|
||||
* PropertiesFileTokenMaker.java - Scanner for properties files.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* This class splits up text into tokens representing a Java properties file.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>PropertiesFileTokenMaker.java</code> file will
|
||||
* contain two definitions of both <code>zzRefill</code> and
|
||||
* <code>yyreset</code>. You should hand-delete the second of each definition
|
||||
* (the ones generated by the lexer), as these generated methods modify the
|
||||
* input buffer, which we'll never have to do.
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.4
|
||||
*
|
||||
*/
|
||||
public class PropertiesFileTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** initial size of the lookahead buffer */
|
||||
private static final int ZZ_BUFFERSIZE = 16384;
|
||||
/** lexical states */
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int VALUE = 1;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\3\1\2\25\0\1\3\1\4\1\0\1\4\3\0\1\5"
|
||||
+ "\22\0\1\1\2\0\1\1\36\0\1\6\36\0\1\7\1\0\1\10" + "\uff82\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\1\1\1\0\1\1\1\2\1\3\1\4\1\5\1\6" + "\1\7\1\10\1\6\1\5\1\10";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[13];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\11\0\22\0\33\0\44\0\55\0\66\0\77"
|
||||
+ "\0\110\0\121\0\33\0\33\0\33";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[13];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\3\1\4\1\0\1\5\1\6\4\3\5\7\1\10"
|
||||
+ "\1\11\1\12\1\7\1\3\4\0\4\3\14\0\1\5" + "\5\0\2\6\1\0\6\6\5\7\3\0\1\7\5\10"
|
||||
+ "\1\13\3\10\2\14\1\0\6\14\10\12\1\15";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[90];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\1\1\0\1\1\1\11\6\1\3\11";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[13];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public PropertiesFileTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = VALUE;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
* @exception IOException if any I/O-Error occurs.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public PropertiesFileTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public PropertiesFileTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 42) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 7: {
|
||||
addToken(start, zzEndRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 9:
|
||||
break;
|
||||
case 2: {
|
||||
start = zzMarkedPos;
|
||||
addToken(Token.OPERATOR);
|
||||
yybegin(VALUE);
|
||||
}
|
||||
case 10:
|
||||
break;
|
||||
case 8: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
addToken(temp, zzMarkedPos - 1, Token.VARIABLE);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 11:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 12:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(start, zzMarkedPos - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 13:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 14:
|
||||
break;
|
||||
case 5: {
|
||||
}
|
||||
case 15:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
}
|
||||
case 16:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 14:
|
||||
break;
|
||||
case VALUE: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 15:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,438 +0,0 @@
|
||||
/*
|
||||
* 12/06/2005
|
||||
*
|
||||
* PythonTokenMaker.java - Token maker for the Python programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenMaker;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Python programming language.
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.3
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class PythonTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public PythonTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = LONG_STRING_2;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = LONG_STRING_1;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
/* This part is taken from http://www.python.org/doc/2.2.3/ref/grammar.txt */
|
||||
identifier = (({letter}|"_")({letter}|{digit}|"_")*)
|
||||
letter = ({lowercase}|{uppercase})
|
||||
lowercase = ([a-z])
|
||||
uppercase = ([A-Z])
|
||||
digit = ([0-9])
|
||||
stringliteral = ({stringprefix}?{shortstring})
|
||||
stringprefix = ("r"|"u"[rR]?|"R"|"U"[rR]?)
|
||||
shortstring1 = ([\']{shortstring1item}*[\']?)
|
||||
shortstring2 = ([\"]{shortstring2item}*[\"]?)
|
||||
shortstring = ({shortstring1}|{shortstring2})
|
||||
shortstring1item = ({shortstring1char}|{escapeseq})
|
||||
shortstring2item = ({shortstring2char}|{escapeseq})
|
||||
shortstring1char = ([^\\\n\'])
|
||||
shortstring2char = ([^\\\n\"])
|
||||
escapeseq = ([\\].)
|
||||
longinteger = ({integer}[lL])
|
||||
integer = ({decimalinteger}|{octinteger}|{hexinteger})
|
||||
decimalinteger = ({nonzerodigit}{digit}*|"0")
|
||||
octinteger = ("0"{octdigit}+)
|
||||
hexinteger = ("0"[xX]{hexdigit}+)
|
||||
nonzerodigit = ([1-9])
|
||||
octdigit = ([0-7])
|
||||
hexdigit = ({digit}|[a-f]|[A-F])
|
||||
floatnumber = ({pointfloat}|{exponentfloat})
|
||||
pointfloat = ({intpart}?{fraction}|{intpart}".")
|
||||
exponentfloat = (({intpart}|{pointfloat}){exponent})
|
||||
intpart = ({digit}+)
|
||||
fraction = ("."{digit}+)
|
||||
exponent = ([eE][\+\-]?{digit}+)
|
||||
imagnumber = (({floatnumber}|{intpart})[jJ])
|
||||
|
||||
ErrorNumberFormat = ({digit}{NonSeparator}+)
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#")
|
||||
|
||||
LongStringStart1 = ({stringprefix}?\'\'\')
|
||||
LongStringStart2 = ({stringprefix}?\"\"\")
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
LineComment = ("#".*)
|
||||
|
||||
|
||||
%state LONG_STRING_1
|
||||
%state LONG_STRING_2
|
||||
|
||||
|
||||
%%
|
||||
|
||||
/* Keywords */
|
||||
<YYINITIAL> "and" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "as" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "assert" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "break" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "class" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "continue" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "def" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "del" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "elif" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "else" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "except" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "exec" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "finally" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "for" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "from" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "global" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "if" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "import" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "in" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "is" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lambda" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "not" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "or" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "pass" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "print" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "raise" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "return" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "try" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "while" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "yield" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Data types. */
|
||||
<YYINITIAL> "char" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "double" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "float" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "int" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "long" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "short" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "signed" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "unsigned" { addToken(Token.DATA_TYPE); }
|
||||
<YYINITIAL> "void" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Standard functions */
|
||||
<YYINITIAL> "abs" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "apply" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "bool" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "buffer" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "callable" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "chr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "classmethod" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "cmp" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "coerce" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "compile" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "complex" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "delattr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "dict" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "dir" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "divmod" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "enumerate" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "eval" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "execfile" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "file" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "filter" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "float" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "getattr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "globals" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "hasattr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "hash" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "hex" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "id" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "input" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "int" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "intern" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "isinstance" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "issubclass" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "iter" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "len" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "list" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "locals" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "long" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "map" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "max" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "min" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "object" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "oct" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "open" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "ord" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "pow" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "property" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "range" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "raw_input" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "reduce" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "reload" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "repr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "round" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "setattr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "slice" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "staticmethod" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "str" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "sum" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "super" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "tuple" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "type" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "unichr" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "unicode" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "vars" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "xrange" { addToken(Token.FUNCTION); }
|
||||
<YYINITIAL> "zip" { addToken(Token.FUNCTION); }
|
||||
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character Literals. */
|
||||
{stringliteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{LongStringStart1} { yybegin(LONG_STRING_1); addToken(Token.LITERAL_CHAR); }
|
||||
{LongStringStart2} { yybegin(LONG_STRING_2); addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
|
||||
/* Comment Literals. */
|
||||
{LineComment} { addToken(Token.COMMENT_EOL); }
|
||||
|
||||
/* Separators. */
|
||||
"(" { addToken(Token.SEPARATOR); }
|
||||
")" { addToken(Token.SEPARATOR); }
|
||||
"[" { addToken(Token.SEPARATOR); }
|
||||
"]" { addToken(Token.SEPARATOR); }
|
||||
"{" { addToken(Token.SEPARATOR); }
|
||||
"}" { addToken(Token.SEPARATOR); }
|
||||
|
||||
/* Operators. */
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
"+" { addToken(Token.OPERATOR); }
|
||||
"-" { addToken(Token.OPERATOR); }
|
||||
"*" { addToken(Token.OPERATOR); }
|
||||
"/" { addToken(Token.OPERATOR); }
|
||||
"%" { addToken(Token.OPERATOR); }
|
||||
"**" { addToken(Token.OPERATOR); }
|
||||
"~" { addToken(Token.OPERATOR); }
|
||||
"<" { addToken(Token.OPERATOR); }
|
||||
">" { addToken(Token.OPERATOR); }
|
||||
"<<" { addToken(Token.OPERATOR); }
|
||||
">>" { addToken(Token.OPERATOR); }
|
||||
"==" { addToken(Token.OPERATOR); }
|
||||
"+=" { addToken(Token.OPERATOR); }
|
||||
"-=" { addToken(Token.OPERATOR); }
|
||||
"*=" { addToken(Token.OPERATOR); }
|
||||
"/=" { addToken(Token.OPERATOR); }
|
||||
"%=" { addToken(Token.OPERATOR); }
|
||||
">>=" { addToken(Token.OPERATOR); }
|
||||
"<<=" { addToken(Token.OPERATOR); }
|
||||
"^" { addToken(Token.OPERATOR); }
|
||||
"&" { addToken(Token.OPERATOR); }
|
||||
"&&" { addToken(Token.OPERATOR); }
|
||||
"|" { addToken(Token.OPERATOR); }
|
||||
"||" { addToken(Token.OPERATOR); }
|
||||
"?" { addToken(Token.OPERATOR); }
|
||||
":" { addToken(Token.OPERATOR); }
|
||||
"," { addToken(Token.OPERATOR); }
|
||||
"!" { addToken(Token.OPERATOR); }
|
||||
"++" { addToken(Token.OPERATOR); }
|
||||
"--" { addToken(Token.OPERATOR); }
|
||||
"." { addToken(Token.OPERATOR); }
|
||||
"," { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{longinteger}|{integer} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{floatnumber}|{imagnumber} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
/* Other punctuation, we'll highlight it as "identifiers." */
|
||||
"@" { addToken(Token.IDENTIFIER); }
|
||||
";" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<LONG_STRING_1> {
|
||||
[^\']+ { addToken(Token.LITERAL_CHAR); }
|
||||
"'''" { yybegin(YYINITIAL); addToken(Token.LITERAL_CHAR); }
|
||||
"'" { addToken(Token.LITERAL_CHAR); }
|
||||
<<EOF>> {
|
||||
if (firstToken==null) {
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
<LONG_STRING_2> {
|
||||
[^\"]+ { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\"\"\" { yybegin(YYINITIAL); addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
\" { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> {
|
||||
if (firstToken==null) {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
@@ -1,857 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 10/16/06 10:31 AM */
|
||||
/*
|
||||
* 12/06/2005
|
||||
* PythonTokenMaker.java - Token maker for the Python programming language.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for the Python programming language.
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.3
|
||||
*/
|
||||
public class PythonTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int LONG_STRING_2 = 2;
|
||||
public static final int LONG_STRING_1 = 1;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\34\1\12\1\0\1\34\1\32\22\0\1\34\1\64\1\11"
|
||||
+ "\1\33\1\0\1\63\1\67\1\10\1\57\1\57\1\62\1\61\1\64" + "\1\27\1\24\1\63\1\16\7\21\2\3\1\64\1\72\1\65\1\60"
|
||||
+ "\1\66\1\64\1\71\4\23\1\26\1\23\3\2\1\31\1\2\1\15" + "\5\2\1\6\2\2\1\7\2\2\1\20\2\2\1\57\1\13\1\57"
|
||||
+ "\1\64\1\1\1\0\1\35\1\42\1\44\1\37\1\25\1\22\1\52" + "\1\54\1\46\1\30\1\43\1\14\1\51\1\36\1\45\1\47\1\2"
|
||||
+ "\1\4\1\40\1\41\1\5\1\55\1\53\1\17\1\50\1\56\1\57" + "\1\70\1\57\1\64\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\3\0\1\1\1\2\1\3\4\2\2\4\1\5\1\2"
|
||||
+ "\1\3\2\2\1\6\1\2\1\6\1\7\1\10\21\2" + "\1\11\10\6\1\2\2\12\2\4\1\13\1\3\1\14"
|
||||
+ "\1\13\1\14\4\2\2\4\1\0\2\4\1\0\4\2" + "\1\13\1\3\1\13\12\2\1\15\27\2\1\15\3\2"
|
||||
+ "\2\15\1\16\1\15\15\2\3\0\2\14\1\0\12\2" + "\1\4\1\17\1\20\3\2\1\3\15\2\1\15\22\2"
|
||||
+ "\1\21\14\2\1\22\1\23\1\14\6\2\1\21\3\2" + "\1\15\36\2\1\15\17\2\1\15\6\2";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[265];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\73\0\166\0\261\0\354\0\u0127\0\u0162\0\u019d"
|
||||
+ "\0\u01d8\0\u0213\0\u024e\0\u0289\0\261\0\u02c4\0\u02ff\0\u033a"
|
||||
+ "\0\u0375\0\u03b0\0\u03eb\0\u0426\0\u0461\0\u049c\0\u04d7\0\u0512"
|
||||
+ "\0\u054d\0\u0588\0\u05c3\0\u05fe\0\u0639\0\u0674\0\u06af\0\u06ea"
|
||||
+ "\0\u0725\0\u0760\0\u079b\0\u07d6\0\u0811\0\u084c\0\u0887\0\261"
|
||||
+ "\0\u08c2\0\u08fd\0\u0938\0\261\0\u0973\0\u09ae\0\u09e9\0\u0a24"
|
||||
+ "\0\261\0\u0a5f\0\u0a9a\0\u0ad5\0\u0b10\0\u0b4b\0\u0b4b\0\u0b86"
|
||||
+ "\0\u0bc1\0\u0b4b\0\u0bfc\0\u0c37\0\u0c72\0\u0cad\0\u0ce8\0\u0d23"
|
||||
+ "\0\u0d5e\0\u0d99\0\u0dd4\0\u0e0f\0\u0e4a\0\u0e85\0\u0ec0\0\u0efb"
|
||||
+ "\0\u0f36\0\u0f71\0\u0fac\0\u0fe7\0\u1022\0\u105d\0\u1098\0\u10d3"
|
||||
+ "\0\u110e\0\u1149\0\u1184\0\u11bf\0\u11fa\0\u1235\0\u1270\0\u12ab"
|
||||
+ "\0\u12e6\0\u1321\0\u135c\0\u1397\0\u13d2\0\u140d\0\u1448\0\u1483"
|
||||
+ "\0\u14be\0\u14f9\0\u1534\0\u156f\0\u15aa\0\u15e5\0\u1620\0\u165b"
|
||||
+ "\0\u1696\0\u16d1\0\u170c\0\u1747\0\u1782\0\u17bd\0\u17f8\0\u1833"
|
||||
+ "\0\u186e\0\354\0\u18a9\0\354\0\u18e4\0\u191f\0\u195a\0\u1995"
|
||||
+ "\0\u19d0\0\u1a0b\0\u1a46\0\u1a81\0\u1abc\0\u1af7\0\u1b32\0\u1b6d"
|
||||
+ "\0\u1ba8\0\u1be3\0\u1c1e\0\u1c59\0\u1c94\0\261\0\u1ccf\0\u1d0a"
|
||||
+ "\0\u1d45\0\u1d80\0\u1dbb\0\u1df6\0\u1e31\0\u1e6c\0\u1ea7\0\u1ee2"
|
||||
+ "\0\u1f1d\0\u1f58\0\261\0\261\0\261\0\u1f93\0\u1fce\0\u2009"
|
||||
+ "\0\u2044\0\u207f\0\u20ba\0\u20f5\0\u2130\0\u216b\0\u21a6\0\u21e1"
|
||||
+ "\0\u221c\0\u2257\0\u2292\0\u22cd\0\u2308\0\u2343\0\u237e\0\u23b9"
|
||||
+ "\0\u23f4\0\u242f\0\u237e\0\u246a\0\u24a5\0\u24e0\0\u251b\0\u2556"
|
||||
+ "\0\u2591\0\u25cc\0\u2607\0\u2642\0\u267d\0\u26b8\0\u26f3\0\u272e"
|
||||
+ "\0\u2769\0\u27a4\0\u27df\0\u281a\0\u2855\0\u2890\0\u28cb\0\u2906"
|
||||
+ "\0\u2941\0\u297c\0\u29b7\0\u29f2\0\u2a2d\0\u2a68\0\261\0\261"
|
||||
+ "\0\u2aa3\0\u2ade\0\u2b19\0\u2b54\0\u17bd\0\u2b8f\0\u2bca\0\354"
|
||||
+ "\0\u2c05\0\u2c40\0\u2c7b\0\u2cb6\0\u2cf1\0\u2d2c\0\u2d67\0\u2da2"
|
||||
+ "\0\u2ddd\0\u2e18\0\u2e53\0\u2e8e\0\u2ec9\0\u2f04\0\u2f3f\0\u2f7a"
|
||||
+ "\0\u2fb5\0\u2ff0\0\u302b\0\u3066\0\u30a1\0\u30dc\0\u3117\0\u3152"
|
||||
+ "\0\u318d\0\u31c8\0\u3203\0\u323e\0\u3279\0\u32b4\0\u32ef\0\u332a"
|
||||
+ "\0\u3365\0\u33a0\0\u33db\0\u3416\0\u3451\0\u348c\0\u34c7\0\u3502"
|
||||
+ "\0\u353d\0\u3578\0\u35b3\0\u35ee\0\u33db\0\u3629\0\u3664\0\u369f"
|
||||
+ "\0\u36da\0\u3715\0\u1270\0\u3750\0\u378b\0\u37c6\0\u3801\0\u383c" + "\0\u3877";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[265];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\4\2\5\1\6\1\7\1\10\1\11\1\12\1\13"
|
||||
+ "\1\14\1\15\1\4\1\16\1\5\1\17\1\20\1\5" + "\1\6\1\21\1\5\1\22\1\23\1\5\1\24\2\5"
|
||||
+ "\1\4\1\25\1\26\1\27\1\30\1\31\1\32\1\33" + "\1\34\1\5\1\35\1\36\1\37\1\40\1\41\1\42"
|
||||
+ "\1\43\1\44\1\45\1\46\1\47\1\50\1\51\1\52" + "\1\53\1\51\1\54\1\55\1\56\1\57\1\60\2\61"
|
||||
+ "\10\62\1\63\62\62\11\64\1\65\61\64\74\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\22\5"
|
||||
+ "\14\0\3\66\1\6\4\66\3\0\1\66\2\67\1\6" + "\2\66\1\6\2\66\1\70\2\71\1\0\2\72\1\0"
|
||||
+ "\1\66\1\0\22\66\12\0\1\66\2\0\7\5\1\13" + "\1\14\2\0\10\5\1\0\1\73\1\5\1\0\2\5"
|
||||
+ "\3\0\1\74\7\5\1\75\11\5\15\0\3\5\1\11" + "\1\5\1\11\1\5\1\13\1\14\2\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\1\5\1\76\20\5\15\0" + "\7\5\1\13\1\14\2\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\22\5\15\0\3\5\1\11\1\5\1\11" + "\1\5\1\13\1\14\2\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\22\5\14\0\10\77\1\100\1\77\1\0" + "\1\101\57\77\11\102\1\103\1\0\1\104\57\102\1\0"
|
||||
+ "\7\5\4\0\10\5\1\0\1\105\1\5\1\0\2\5" + "\3\0\1\106\7\5\1\107\1\110\10\5\14\0\3\66"
|
||||
+ "\1\111\4\66\3\0\1\66\2\67\1\112\2\113\1\112" + "\2\66\1\70\2\71\1\0\2\72\1\0\1\66\1\0"
|
||||
+ "\22\66\12\0\1\66\2\0\3\5\1\114\3\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"
|
||||
+ "\3\5\1\115\3\5\4\0\1\116\7\5\1\0\2\5" + "\1\0\2\5\3\0\10\5\1\117\1\120\10\5\17\0"
|
||||
+ "\1\70\12\0\1\70\2\0\1\70\52\0\7\5\4\0" + "\1\121\2\5\1\122\4\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\1\5\1\123\16\5\1\124\1\5\43\0\1\54" + "\30\0\1\54\12\0\12\25\1\0\60\25\34\0\1\26"
|
||||
+ "\37\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\1\5\1\125\1\5\1\126\1\5\1\127\4\5"
|
||||
+ "\1\130\7\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\10\5\1\131\11\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\1\132\1\5\1\0\2\5\3\0" + "\10\5\1\133\1\134\10\5\15\0\4\5\1\135\2\5"
|
||||
+ "\4\0\1\136\7\5\1\0\1\137\1\5\1\0\2\5" + "\3\0\4\5\1\140\4\5\1\141\5\5\1\142\2\5"
|
||||
+ "\15\0\3\5\1\143\1\144\2\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\13\5\1\145\6\5\15\0"
|
||||
+ "\3\5\1\146\1\147\2\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\10\5\1\150\11\5\15\0\7\5"
|
||||
+ "\4\0\1\151\7\5\1\0\2\5\1\0\2\5\3\0" + "\1\152\7\5\1\153\3\5\1\154\2\5\1\155\2\5"
|
||||
+ "\15\0\3\5\1\156\3\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\5\5\1\157\1\5\1\160\2\5"
|
||||
+ "\1\161\7\5\15\0\7\5\4\0\6\5\1\162\1\5" + "\1\0\2\5\1\0\2\5\3\0\1\5\1\163\1\164"
|
||||
+ "\1\165\1\166\7\5\1\167\5\5\15\0\3\5\1\170" + "\3\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\1\171\7\5\1\172\11\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\11\5\1\173\10\5"
|
||||
+ "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\1\174\10\5\1\105\10\5\15\0\7\5\4\0"
|
||||
+ "\1\175\7\5\1\0\1\137\1\5\1\0\2\5\3\0" + "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\17\5\1\176\2\5\15\0\7\5\4\0" + "\10\5\1\0\1\177\1\5\1\0\2\5\3\0\1\200"
|
||||
+ "\21\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\1\201\7\5\1\202\11\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\11\5" + "\1\154\10\5\74\0\1\54\72\0\2\54\71\0\1\54"
|
||||
+ "\1\0\1\54\75\0\1\51\73\0\1\51\73\0\1\54" + "\73\0\1\54\2\0\10\62\1\0\62\62\10\0\1\203"
|
||||
+ "\62\0\11\64\1\0\61\64\11\0\1\204\61\0\10\66" + "\3\0\11\66\1\0\2\66\1\0\2\66\1\0\1\66"
|
||||
+ "\1\0\22\66\12\0\1\66\4\0\1\70\12\0\1\70" + "\2\0\1\70\3\0\2\205\1\0\2\206\41\0\3\66"
|
||||
+ "\1\207\4\66\3\0\3\66\1\207\2\66\1\207\2\66" + "\1\0\2\66\1\210\2\66\1\0\1\66\1\0\22\66"
|
||||
+ "\2\0\1\210\7\0\1\66\2\0\7\5\4\0\1\211" + "\7\5\1\0\2\5\1\0\2\5\3\0\2\5\1\212"
|
||||
+ "\1\5\1\213\5\5\1\214\7\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\1\5\1\215"
|
||||
+ "\7\5\1\216\4\5\1\217\3\5\15\0\4\5\1\220" + "\2\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\3\5\1\221\5\5\1\222\10\5\14\0"
|
||||
+ "\10\77\1\223\1\77\1\0\1\101\57\77\10\0\1\224" + "\62\0\12\77\1\0\60\77\11\102\1\223\1\0\1\104"
|
||||
+ "\57\102\11\0\1\225\61\0\12\102\1\0\60\102\1\0" + "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\1\5\1\164\20\5\15\0\7\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\14\5\1\226\5\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\1\5\1\227\5\5\1\230\12\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\3\5\1\160" + "\16\5\14\0\3\66\1\111\4\66\3\0\3\66\1\111"
|
||||
+ "\2\66\1\111\2\66\1\70\2\71\1\0\2\72\1\0" + "\1\66\1\0\22\66\12\0\1\66\1\0\3\66\1\111"
|
||||
+ "\4\66\3\0\1\66\2\67\1\112\2\66\1\112\2\66" + "\1\70\2\71\1\0\2\72\1\0\1\66\1\0\22\66"
|
||||
+ "\12\0\1\66\1\0\3\66\1\231\4\66\3\0\3\66" + "\1\231\2\66\3\231\1\0\2\231\1\0\2\66\1\0"
|
||||
+ "\1\66\1\0\1\231\1\66\1\231\2\66\1\231\1\66" + "\1\231\12\66\12\0\1\66\2\0\7\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\1\232\21\5\15\0" + "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\10\5\1\233\11\5\15\0\7\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\10\5\1\234\11\5\15\0"
|
||||
+ "\3\5\1\162\3\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\22\5\15\0\7\5\4\0\1\235\7\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\1\5\1\236\20\5" + "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\3\5\1\237\5\5\1\240\10\5\15\0\7\5" + "\4\0\10\5\1\0\1\241\1\5\1\0\2\5\3\0"
|
||||
+ "\7\5\1\242\12\5\15\0\4\5\1\243\2\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\1\244\21\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\2\5\1\162\17\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\3\5"
|
||||
+ "\1\245\16\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\3\5\1\164\16\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5" + "\1\246\7\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\4\5\1\162\15\5\15\0\7\5" + "\4\0\1\247\5\5\1\162\1\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\22\5\15\0\4\5\1\250\2\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"
|
||||
+ "\3\5\1\164\3\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\7\5\1\160\10\5\1\251\1\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\12\5\1\166\1\5\1\164\5\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\11\5\1\252" + "\10\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\4\5\1\253\15\5\15\0\3\5\1\164" + "\3\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\1\254\21\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\15\5\1\255\4\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5" + "\1\256\11\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\13\5\1\162\6\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"
|
||||
+ "\1\257\7\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\12\5\1\260\7\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\1\261\1\5\1\0\2\5\3\0" + "\22\5\15\0\7\5\4\0\6\5\1\262\1\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\10\5\1\244"
|
||||
+ "\11\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\1\263\21\5\15\0\7\5\4\0\1\264"
|
||||
+ "\7\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0" + "\7\5\4\0\10\5\1\0\1\265\1\5\1\0\2\5"
|
||||
+ "\3\0\1\5\1\266\12\5\1\267\5\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"
|
||||
+ "\1\164\7\5\15\0\3\5\1\164\3\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\1\270\21\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\2\5\1\164\17\5\15\0\7\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\1\271\1\5\3\0\22\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\4\5"
|
||||
+ "\1\164\15\5\15\0\7\5\4\0\10\5\1\0\1\105" + "\1\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\4\5\1\272" + "\5\5\1\273\7\5\15\0\7\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\3\5\1\274\5\5\1\275" + "\10\5\15\0\7\5\4\0\10\5\1\0\1\214\1\5"
|
||||
+ "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\12\5\1\276\7\5"
|
||||
+ "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\10\5\1\277\1\300\10\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\3\5\1\301" + "\16\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\16\5\1\164\3\5\15\0\7\5\4\0" + "\10\5\1\0\1\302\1\5\1\0\2\5\3\0\22\5"
|
||||
+ "\15\0\7\5\4\0\3\5\1\164\4\5\1\0\2\5" + "\1\0\2\5\3\0\12\5\1\164\7\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5" + "\1\303\11\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\11\5\1\304\10\5\15\0\7\5" + "\4\0\3\5\1\164\4\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\22\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\3\5\1\305\16\5\15\0\3\5"
|
||||
+ "\1\127\3\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\22\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\11\5\1\306\10\5\24\0\1\307" + "\73\0\1\310\64\0\1\311\12\0\1\311\2\0\1\311"
|
||||
+ "\5\0\1\210\31\0\1\210\11\0\3\66\1\207\4\66" + "\3\0\3\66\1\207\2\66\1\207\2\66\1\0\2\66"
|
||||
+ "\1\0\2\72\1\0\1\66\1\0\22\66\12\0\1\66" + "\4\0\1\311\12\0\1\311\2\0\1\311\52\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5" + "\1\312\11\5\15\0\4\5\1\252\2\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\4\5" + "\1\313\2\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\22\5\15\0\3\5\1\164\3\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\15\5" + "\1\260\4\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\3\5\1\237\16\5\15\0\1\314" + "\6\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\1\5\1\315\20\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\11\5\1\141" + "\10\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\7\5\1\316\12\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\5\5\1\317"
|
||||
+ "\14\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\15\5\1\320\4\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\1\321\21\5" + "\14\0\3\66\1\231\4\66\3\0\1\66\2\67\1\231"
|
||||
+ "\2\66\3\231\1\0\2\231\1\0\2\66\1\0\1\66" + "\1\0\1\231\1\66\1\231\2\66\1\231\1\66\1\231"
|
||||
+ "\12\66\12\0\1\66\2\0\7\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\1\5\1\215\20\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\14\5\1\162\5\5\15\0\7\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\1\322\21\5\15\0\7\5" + "\4\0\10\5\1\0\1\164\1\5\1\0\2\5\3\0"
|
||||
+ "\4\5\1\166\15\5\15\0\7\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\1\323\21\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\1\162\1\5\1\0\2\5\3\0" + "\22\5\15\0\7\5\4\0\6\5\1\162\1\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\7\5\1\324"
|
||||
+ "\12\5\15\0\7\5\4\0\10\5\1\0\1\325\1\5" + "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\14\5\1\326\5\5" + "\15\0\7\5\4\0\1\164\7\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\22\5\15\0\7\5\4\0\10\5\1\0" + "\1\327\1\5\1\0\2\5\3\0\22\5\15\0\7\5"
|
||||
+ "\4\0\1\330\7\5\1\0\2\5\1\0\2\5\3\0" + "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\1\331\21\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\5\5\1\332\14\5"
|
||||
+ "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\14\5\1\333\5\5\15\0\7\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\7\5\1\260\12\5" + "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\4\5\1\334\15\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\1\5\1\335\20\5"
|
||||
+ "\15\0\3\5\1\322\3\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\1\260"
|
||||
+ "\7\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0" + "\7\5\4\0\10\5\1\0\1\164\1\5\1\0\2\5"
|
||||
+ "\3\0\22\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\1\336\21\5\15\0\7\5\4\0"
|
||||
+ "\6\5\1\166\1\5\1\0\2\5\1\0\2\5\3\0" + "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\3\5\1\337\16\5\15\0\7\5\4\0" + "\1\340\7\5\1\0\2\5\1\0\2\5\3\0\22\5"
|
||||
+ "\15\0\3\5\1\252\3\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\4\5\1\341\15\5" + "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\12\5\1\342\7\5\15\0\3\5\1\320\3\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\22\5"
|
||||
+ "\15\0\7\5\4\0\10\5\1\0\1\343\1\5\1\0" + "\2\5\3\0\22\5\15\0\7\5\4\0\10\5\1\0"
|
||||
+ "\1\344\1\5\1\0\2\5\3\0\22\5\15\0\4\5" + "\1\160\2\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\22\5\15\0\4\5\1\345\2\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\1\5" + "\1\346\20\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\10\5\1\327\11\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"
|
||||
+ "\1\347\7\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\1\5\1\131\20\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\3\5" + "\1\162\16\5\15\0\7\5\4\0\1\125\7\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\5\5\1\350"
|
||||
+ "\14\5\15\0\7\5\4\0\1\237\7\5\1\0\2\5" + "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\1\331\16\5\1\164" + "\2\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\2\5\1\320\17\5\17\0\1\311\12\0" + "\1\311\2\0\1\311\6\0\2\206\42\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\1\315\21\5" + "\15\0\3\5\1\351\3\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\11\5\1\352\10\5"
|
||||
+ "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\10\5\1\353\6\5\1\214\2\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\2\5" + "\1\354\17\5\15\0\7\5\4\0\1\127\7\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\4\5\1\320"
|
||||
+ "\15\5\15\0\7\5\4\0\1\355\7\5\1\0\2\5" + "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\6\5"
|
||||
+ "\1\356\1\5\1\0\2\5\1\0\2\5\3\0\22\5" + "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\12\5\1\131\7\5\15\0\7\5\4\0\10\5" + "\1\0\1\357\1\5\1\0\2\5\3\0\22\5\15\0"
|
||||
+ "\3\5\1\131\3\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\22\5\15\0\7\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\13\5\1\164\6\5\15\0" + "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\4\5\1\360\15\5\15\0\7\5\4\0\1\361\7\5" + "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5" + "\1\315\11\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\11\5\1\362\10\5\15\0\7\5" + "\4\0\10\5\1\0\1\306\1\5\1\0\2\5\3\0"
|
||||
+ "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\6\5\1\162\13\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\3\5\1\363" + "\16\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\1\364\21\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\11\5\1\365\10\5"
|
||||
+ "\15\0\7\5\4\0\1\366\7\5\1\0\2\5\1\0" + "\2\5\3\0\11\5\1\257\10\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\7\5\1\160" + "\12\5\15\0\3\5\1\105\3\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\5\5\1\367"
|
||||
+ "\14\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\3\5\1\370\16\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\1\371\1\5\1\0\2\5\3\0\22\5" + "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\1\372\21\5\15\0\7\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\1\5\1\162\20\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\1\5\1\373\20\5\15\0\7\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\2\5\1\260\17\5\15\0" + "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\1\162\21\5\15\0\7\5\4\0\1\143\7\5\1\0" + "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\2\5\1\0\2\5\3\0\11\5\1\257" + "\10\5\15\0\3\5\1\374\3\5\4\0\10\5\1\0"
|
||||
+ "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\4\5\1\214"
|
||||
+ "\15\5\15\0\7\5\4\0\10\5\1\0\1\320\1\5" + "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\7\5\1\375\12\5" + "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"
|
||||
+ "\3\0\14\5\1\376\5\5\15\0\7\5\4\0\10\5" + "\1\0\2\5\1\0\2\5\3\0\5\5\1\257\14\5"
|
||||
+ "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5" + "\3\0\1\5\1\377\20\5\15\0\7\5\4\0\10\5"
|
||||
+ "\1\0\1\177\1\5\1\0\2\5\3\0\22\5\15\0" + "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"
|
||||
+ "\7\5\1\u0100\12\5\15\0\7\5\4\0\10\5\1\0" + "\2\5\1\0\2\5\3\0\4\5\1\u0101\15\5\15\0"
|
||||
+ "\3\5\1\u0102\3\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\22\5\15\0\7\5\4\0\1\u0103\7\5"
|
||||
+ "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"
|
||||
+ "\1\273\7\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\1\u0104\21\5\15\0\7\5\4\0"
|
||||
+ "\10\5\1\0\1\u0105\1\5\1\0\2\5\3\0\22\5" + "\15\0\4\5\1\237\2\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\1\u0106" + "\7\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"
|
||||
+ "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0" + "\1\u0107\21\5\15\0\7\5\4\0\10\5\1\0\2\5"
|
||||
+ "\1\0\2\5\3\0\4\5\1\330\15\5\15\0\7\5" + "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\4\5"
|
||||
+ "\1\260\15\5\15\0\7\5\4\0\10\5\1\0\2\5" + "\1\0\2\5\3\0\4\5\1\u0108\15\5\15\0\7\5"
|
||||
+ "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\1\u0109" + "\21\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"
|
||||
+ "\2\5\3\0\1\5\1\252\20\5\15\0\7\5\4\0" + "\10\5\1\0\2\5\1\0\2\5\3\0\17\5\1\333"
|
||||
+ "\2\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0" + "\2\5\3\0\3\5\1\127\16\5\14\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[14514];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\3\0\1\11\10\1\1\11\32\1\1\11\3\1\1\11"
|
||||
+ "\4\1\1\11\17\1\1\0\2\1\1\0\76\1\3\0" + "\1\11\1\1\1\0\12\1\3\11\61\1\2\11\101\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[265];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public PythonTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = LONG_STRING_2;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = LONG_STRING_1;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public PythonTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public PythonTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 168) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 5: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 12: {
|
||||
addToken(Token.LITERAL_NUMBER_FLOAT);
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 13: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 9: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 15: {
|
||||
yybegin(LONG_STRING_1);
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(Token.FUNCTION);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.ERROR_IDENTIFIER);
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 17: {
|
||||
addToken(Token.DATA_TYPE);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(Token.ERROR_NUMBER_FORMAT);
|
||||
}
|
||||
case 33:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||
}
|
||||
case 34:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 35:
|
||||
break;
|
||||
case 19: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 36:
|
||||
break;
|
||||
case 16: {
|
||||
yybegin(LONG_STRING_2);
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 37:
|
||||
break;
|
||||
case 18: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
case 38:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 266:
|
||||
break;
|
||||
case LONG_STRING_2: {
|
||||
if (firstToken == null) {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
case 267:
|
||||
break;
|
||||
case LONG_STRING_1: {
|
||||
if (firstToken == null) {
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
case 268:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,760 +0,0 @@
|
||||
/*
|
||||
* 09/11/2008
|
||||
*
|
||||
* RubyTokenMaker.java - Scanner for Ruby
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for Ruby.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>RubyTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class RubyTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* an unquoted/double quoted/backtick EOF heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOF_UNQUOTED = -1;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* an single quoted EOF heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOF_SINGLE_QUOTED = -2;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* an double quoted EOF heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOF_DOUBLE_QUOTED = -3;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* an unquoted/double quoted/backtick EOT heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOT_UNQUOTED = -4;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* an single quoted EOT heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOT_SINGLE_QUOTED = -5;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* an double quoted EOT heredoc.
|
||||
*/
|
||||
public static final int INTERNAL_HEREDOC_EOT_DOUBLE_QUOTED = -6;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* a %Q!...! style double quoted string.
|
||||
*/
|
||||
public static final int INTERNAL_STRING_Q_BANG = -7;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* a %Q{...} style double quoted string.
|
||||
*/
|
||||
public static final int INTERNAL_STRING_Q_CURLY_BRACE = -8;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* a %Q<...> style double quoted string.
|
||||
*/
|
||||
public static final int INTERNAL_STRING_Q_LT = -9;
|
||||
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* a %Q(...) style double quoted string.
|
||||
*/
|
||||
public static final int INTERNAL_STRING_Q_PAREN = -10;
|
||||
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* a %Q/.../ style double quoted string.
|
||||
*/
|
||||
public static final int INTERNAL_STRING_Q_SLASH = -11;
|
||||
|
||||
/**
|
||||
* Token type specific to RubyTokenMaker; this signals that we are inside
|
||||
* a %Q[...] style double quoted string.
|
||||
*/
|
||||
public static final int INTERNAL_STRING_Q_SQUARE_BRACKET = -12;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public RubyTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "#", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether tokens of the specified type should have "mark
|
||||
* occurrences" enabled for the current programming language.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences"
|
||||
* enabled.
|
||||
*/
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type==Token.IDENTIFIER || type==Token.VARIABLE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.COMMENT_DOCUMENTATION:
|
||||
state = DOCCOMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR_LITERAL;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_BACKQUOTE:
|
||||
state = BACKTICKS;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOF_UNQUOTED:
|
||||
state = HEREDOC_EOF_UNQUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOF_SINGLE_QUOTED:
|
||||
state = HEREDOC_EOF_SINGLE_QUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOF_DOUBLE_QUOTED:
|
||||
state = HEREDOC_EOF_DOUBLE_QUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOT_UNQUOTED:
|
||||
state = HEREDOC_EOT_UNQUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOT_SINGLE_QUOTED:
|
||||
state = HEREDOC_EOT_SINGLE_QUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_HEREDOC_EOT_DOUBLE_QUOTED:
|
||||
state = HEREDOC_EOT_DOUBLE_QUOTED;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_STRING_Q_BANG:
|
||||
state = STRING_Q_BANG;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_STRING_Q_CURLY_BRACE:
|
||||
state = STRING_Q_CURLY_BRACE;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_STRING_Q_LT:
|
||||
state = STRING_Q_LT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_STRING_Q_PAREN:
|
||||
state = STRING_Q_PAREN;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_STRING_Q_SLASH:
|
||||
state = STRING_Q_SLASH;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_STRING_Q_SQUARE_BRACKET:
|
||||
state = STRING_Q_SQUARE_BRACKET;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
BinaryDigit = ([01])
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'\`]|"#"|"\\")
|
||||
|
||||
IdentifierStart = ({Letter}|"_")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit})
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
LineCommentBegin = "#"
|
||||
DocCommentBegin = "=begin"
|
||||
DocCommentEnd = "=end"
|
||||
|
||||
DigitOrUnderscore = ({Digit}|[_])
|
||||
BinaryIntLiteral = ("0b"{BinaryDigit}([01_]*{BinaryDigit})?)
|
||||
OctalLiteral = ("0"([0-7_]*{OctalDigit})?)
|
||||
DecimalLiteral1 = ("0d"{Digit}({DigitOrUnderscore}*{Digit})?)
|
||||
DecimalLiteral2 = ({NonzeroDigit}({DigitOrUnderscore}*{Digit})?)
|
||||
DecimalLiteral = ({BinaryIntLiteral}|{OctalLiteral}|{DecimalLiteral1}|{DecimalLiteral2})
|
||||
HexLiteral = ("0x"{HexDigit}([0-9a-zA-Z_]*{HexDigit})?)
|
||||
FloatLiteral = ({NonzeroDigit}({DigitOrUnderscore}*{Digit})?[Ee][+-]?({Digit}({DigitOrUnderscore}*{Digit})?)?)
|
||||
|
||||
Separator = ([\(\)\{\}])
|
||||
Operator1 = ("::"|"."|"["|"]"|"-"|"+"|"!"|"~"|"*"|"/"|"%"|"<<"|">>"|"&"|"|"|"^")
|
||||
Operator2 = (">"|">="|"<"|"<="|"<=>"|"=="|"==="|"!="|"=~"|"!~"|"&&"|"||")
|
||||
Operator3 = (".."|"..."|"="|"+="|"-="|"*="|"/="|"%=")
|
||||
Operator = ({Operator1}|{Operator2}|{Operator3})
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
Symbol = ([:]{Identifier})
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
PreDefinedVariable = ("$"([!@&`\'+0-9~=/\,;.<>_*$?:\"]|"DEBUG"|"FILENAME"|"LOAD_PATH"|"stderr"|"stdin"|"stdout"|"VERBOSE"|([\-][0adFiIlpwv])))
|
||||
Variable = ({PreDefinedVariable}|([@][@]?|[$]){Identifier})
|
||||
|
||||
%state STRING
|
||||
%state STRING_Q_BANG
|
||||
%state STRING_Q_CURLY_BRACE
|
||||
%state STRING_Q_PAREN
|
||||
%state STRING_Q_SLASH
|
||||
%state STRING_Q_SQUARE_BRACKET
|
||||
%state STRING_Q_LT
|
||||
%state CHAR_LITERAL
|
||||
%state BACKTICKS
|
||||
%state HEREDOC_EOF_UNQUOTED
|
||||
%state HEREDOC_EOF_SINGLE_QUOTED
|
||||
%state HEREDOC_EOF_DOUBLE_QUOTED
|
||||
%state HEREDOC_EOT_UNQUOTED
|
||||
%state HEREDOC_EOT_SINGLE_QUOTED
|
||||
%state HEREDOC_EOT_DOUBLE_QUOTED
|
||||
%state DOCCOMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"alias" |
|
||||
"BEGIN" |
|
||||
"begin" |
|
||||
"break" |
|
||||
"case" |
|
||||
"class" |
|
||||
"def" |
|
||||
"defined" |
|
||||
"do" |
|
||||
"else" |
|
||||
"elsif" |
|
||||
"END" |
|
||||
"end" |
|
||||
"ensure" |
|
||||
"for" |
|
||||
"if" |
|
||||
"in" |
|
||||
"module" |
|
||||
"next" |
|
||||
"nil" |
|
||||
"redo" |
|
||||
"rescue" |
|
||||
"retry" |
|
||||
"return" |
|
||||
"self" |
|
||||
"super" |
|
||||
"then" |
|
||||
"undef" |
|
||||
"unless" |
|
||||
"until" |
|
||||
"when" |
|
||||
"while" |
|
||||
"yield" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
"Array" |
|
||||
"Float" |
|
||||
"Integer" |
|
||||
"String" |
|
||||
"at_exit" |
|
||||
"autoload" |
|
||||
"binding" |
|
||||
"caller" |
|
||||
"catch" |
|
||||
"chop" |
|
||||
"chop!" |
|
||||
"chomp" |
|
||||
"chomp!" |
|
||||
"eval" |
|
||||
"exec" |
|
||||
"exit" |
|
||||
"exit!" |
|
||||
"fail" |
|
||||
"fork" |
|
||||
"format" |
|
||||
"gets" |
|
||||
"global_variables" |
|
||||
"gsub" |
|
||||
"gsub!" |
|
||||
"iterator?" |
|
||||
"lambda" |
|
||||
"load" |
|
||||
"local_variables" |
|
||||
"loop" |
|
||||
"open" |
|
||||
"p" |
|
||||
"print" |
|
||||
"printf" |
|
||||
"proc" |
|
||||
"putc" |
|
||||
"puts" |
|
||||
"raise" |
|
||||
"rand" |
|
||||
"readline" |
|
||||
"readlines" |
|
||||
"require" |
|
||||
"select" |
|
||||
"sleep" |
|
||||
"split" |
|
||||
"sprintf" |
|
||||
"srand" |
|
||||
"sub" |
|
||||
"sub!" |
|
||||
"syscall" |
|
||||
"system" |
|
||||
"test" |
|
||||
"trace_var" |
|
||||
"trap" |
|
||||
"untrace_var" { addToken(Token.FUNCTION); }
|
||||
|
||||
"and" |
|
||||
"or" |
|
||||
"not" { addToken(Token.OPERATOR); }
|
||||
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{Variable} { addToken(Token.VARIABLE); }
|
||||
{Symbol} { addToken(Token.PREPROCESSOR); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
\" { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
\' { start = zzMarkedPos-1; yybegin(CHAR_LITERAL); }
|
||||
[\%][QqWwx]?[\(] { start = zzMarkedPos-yylength(); yybegin(STRING_Q_PAREN); }
|
||||
[\%][QqWwx]?[\{] { start = zzMarkedPos-yylength(); yybegin(STRING_Q_CURLY_BRACE); }
|
||||
[\%][QqWwx]?[\[] { start = zzMarkedPos-yylength(); yybegin(STRING_Q_SQUARE_BRACKET); }
|
||||
[\%][QqWwx]?[\<] { start = zzMarkedPos-yylength(); yybegin(STRING_Q_LT); }
|
||||
[\%][QqWwx]?[\!] { start = zzMarkedPos-yylength(); yybegin(STRING_Q_BANG); }
|
||||
[\%][QqWwx]?[\/] { start = zzMarkedPos-yylength(); yybegin(STRING_Q_SLASH); }
|
||||
\` { start = zzMarkedPos-1; yybegin(BACKTICKS); }
|
||||
|
||||
/* Comment literals. */
|
||||
{LineCommentBegin}.* { addToken(Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
{DocCommentBegin} { start = zzMarkedPos-6; yybegin(DOCCOMMENT); }
|
||||
|
||||
/* "Here-document" syntax. This is only implemented for the common */
|
||||
/* cases. */
|
||||
"<<EOF" { start = zzStartRead; yybegin(HEREDOC_EOF_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \""EOF"\" { start = zzStartRead; yybegin(HEREDOC_EOF_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \'"EOF"\' { start = zzStartRead; yybegin(HEREDOC_EOF_SINGLE_QUOTED); }
|
||||
"<<" {WhiteSpace}* \`"EOF"\` { start = zzStartRead; yybegin(HEREDOC_EOF_UNQUOTED); }
|
||||
"<<EOT" { start = zzStartRead; yybegin(HEREDOC_EOT_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \""EOT"\" { start = zzStartRead; yybegin(HEREDOC_EOT_UNQUOTED); }
|
||||
"<<" {WhiteSpace}* \'"EOT"\' { start = zzStartRead; yybegin(HEREDOC_EOT_SINGLE_QUOTED); }
|
||||
"<<" {WhiteSpace}* \`"EOT"\` { start = zzStartRead; yybegin(HEREDOC_EOT_UNQUOTED); }
|
||||
|
||||
/* Separators and operators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{DecimalLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<STRING_Q_BANG> {
|
||||
[^\n\\\!]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_BANG); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\! { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_BANG); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<STRING_Q_CURLY_BRACE> {
|
||||
[^\n\\\}]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_CURLY_BRACE); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\} { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_CURLY_BRACE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<STRING_Q_LT> {
|
||||
[^\n\\\>]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_LT); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\> { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_LT); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<STRING_Q_PAREN> {
|
||||
[^\n\\\)]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_PAREN); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\) { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_PAREN); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<STRING_Q_SLASH> {
|
||||
[^\n\\\/]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_SLASH); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\/ { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_SLASH); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<STRING_Q_SQUARE_BRACKET> {
|
||||
[^\n\\\]]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_SQUARE_BRACKET); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\] { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); addEndToken(INTERNAL_STRING_Q_SQUARE_BRACKET); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<CHAR_LITERAL> {
|
||||
[^\n\\\']+ {}
|
||||
\\.? { /* Skip escaped single quotes only, but this should still work. */ }
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
\' { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<BACKTICKS> {
|
||||
[^\n\\\`]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
\` { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_BACKQUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_BACKQUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOF_UNQUOTED> {
|
||||
/* NOTE: The closing "EOF" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOF"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOF" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
/* NOTE2: This case is used for unquoted <<EOF, double quoted */
|
||||
/* <<"EOF" and backticks <<`EOF`, since they all follow the same */
|
||||
/* syntactic rules. */
|
||||
"EOF" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_UNQUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_UNQUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOF_SINGLE_QUOTED> {
|
||||
/* NOTE: The closing "EOF" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOF"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOF" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
"EOF" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_SINGLE_QUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_SINGLE_QUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOF_DOUBLE_QUOTED> {
|
||||
/* NOTE: The closing "EOF" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOF"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOF" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
"EOF" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_SINGLE_QUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOF_SINGLE_QUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOT_UNQUOTED> {
|
||||
/* NOTE: The closing "EOT" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOT"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOT" will match any line containing */
|
||||
/* EOF and any other chars. */
|
||||
/* NOTE2: This case is used for unquoted <<EOT, double quoted */
|
||||
/* <<"EOT" and backticks <<`EOT`, since they all follow the same */
|
||||
/* syntactic rules. */
|
||||
"EOT" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_UNQUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_UNQUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOT_SINGLE_QUOTED> {
|
||||
/* NOTE: The closing "EOT" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOT"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOT" will match any line containing */
|
||||
/* EOT and any other chars. */
|
||||
"EOT" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_SINGLE_QUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_SINGLE_QUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<HEREDOC_EOT_DOUBLE_QUOTED> {
|
||||
/* NOTE: The closing "EOT" is supposed to be on a line by itself - */
|
||||
/* no surrounding whitespace or other chars. However, the way */
|
||||
/* we're hacking the JFLex scanning, something like ^"EOT"$ doesn't */
|
||||
/* work. Fortunately we don't need the start- and end-line anchors */
|
||||
/* since the production after "EOT" will match any line containing */
|
||||
/* EOT and any other chars. */
|
||||
"EOT" { if (start==zzStartRead) { addToken(Token.PREPROCESSOR); addNullToken(); return firstToken; } }
|
||||
[^\n\\]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_SINGLE_QUOTED); return firstToken; }
|
||||
\\.? { /* Skip escaped chars. */ }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.PREPROCESSOR); addEndToken(INTERNAL_HEREDOC_EOT_SINGLE_QUOTED); return firstToken; }
|
||||
}
|
||||
|
||||
|
||||
<DOCCOMMENT> {
|
||||
|
||||
[^\n\=]+ {}
|
||||
{DocCommentEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+3, Token.COMMENT_DOCUMENTATION); }
|
||||
= {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); return firstToken; }
|
||||
<<EOF>> { yybegin(YYINITIAL); addToken(start,zzEndRead, Token.COMMENT_DOCUMENTATION); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,672 +0,0 @@
|
||||
/*
|
||||
* 02/25/2005
|
||||
*
|
||||
* SASTokenMaker.java - Scanner for SAS files.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class generates tokens representing a text stream as SAS.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>SASTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class SASTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public SASTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "*", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether tokens of the specified type should have "mark
|
||||
* occurrences" enabled for the current programming language.
|
||||
*
|
||||
* @param type The token type.
|
||||
* @return Whether tokens of this type should have "mark occurrences"
|
||||
* enabled.
|
||||
*/
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type==Token.IDENTIFIER || type==Token.VARIABLE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
LineTerminator = ([\n])
|
||||
Letter = ([A-Za-z_])
|
||||
Digit = ([0-9])
|
||||
Whitespace = ([ \t]+)
|
||||
Semicolon = ([;])
|
||||
|
||||
Identifier = (({Letter}|{Digit})+)
|
||||
MacroVariable = (&{Identifier})
|
||||
|
||||
Operators1 = ("+"|"-"|"*"|"/"|"^"|"|")
|
||||
Operators2 = (([\^\~]?=)|(">"[=]?)|("<"[=]?))
|
||||
Operators3 = ("eq"|"ne"|"gt"|"lt"|"ge"|"le"|"in")
|
||||
Operator = ({Operators1}|{Operators2}|{Operators3})
|
||||
Separator = ([\(\)])
|
||||
|
||||
StringBoundary = (\")
|
||||
CharBoundary = (\')
|
||||
|
||||
LineCommentBegin = ("*")
|
||||
MLCBegin = ("/*")
|
||||
MLCEnd = ("*/")
|
||||
|
||||
%state STRING
|
||||
%state CHAR
|
||||
%state MLC
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"_all_" |
|
||||
"_character_" |
|
||||
"_data_" |
|
||||
"_infile_" |
|
||||
"_last_" |
|
||||
"_null_" |
|
||||
"_numeric_" |
|
||||
"_page_" |
|
||||
"_temporary_" |
|
||||
"abend" |
|
||||
"abort" |
|
||||
"all" |
|
||||
"alter" |
|
||||
"and" |
|
||||
"array" |
|
||||
"as" |
|
||||
"ascending" |
|
||||
"attrib" |
|
||||
"axis" |
|
||||
"bell" |
|
||||
"blank" |
|
||||
"border" |
|
||||
"bounds" |
|
||||
"by" |
|
||||
"call" |
|
||||
"cancel" |
|
||||
"cards" |
|
||||
"cards4" |
|
||||
"choro" |
|
||||
"class" |
|
||||
"classes" |
|
||||
"clear" |
|
||||
"close" |
|
||||
"compute" |
|
||||
"contrast" |
|
||||
"coord" |
|
||||
"coordinates" |
|
||||
"cov" |
|
||||
"create" |
|
||||
"data" |
|
||||
"datalines" |
|
||||
"datalines4" |
|
||||
"delete" |
|
||||
"descending" |
|
||||
"describe" |
|
||||
"discrete" |
|
||||
"disk" |
|
||||
"display" |
|
||||
"dm" |
|
||||
"do" |
|
||||
"drop" |
|
||||
"dummy" |
|
||||
"else" |
|
||||
"end" |
|
||||
"endrsubmit" |
|
||||
"endsas" |
|
||||
"error" |
|
||||
"except" |
|
||||
"expandtabs" |
|
||||
"factors" |
|
||||
"file" |
|
||||
"filename" |
|
||||
"flowover" |
|
||||
"footnote" |
|
||||
"frame" |
|
||||
"freq" |
|
||||
"from" |
|
||||
"go" |
|
||||
"goption" |
|
||||
"goptions" |
|
||||
"goto" |
|
||||
"grid" |
|
||||
"group" |
|
||||
"groupby" |
|
||||
"groupformat" |
|
||||
"having" |
|
||||
"haxis" |
|
||||
"hbar" |
|
||||
"heading" |
|
||||
"high" |
|
||||
"html" |
|
||||
"id" |
|
||||
"if" |
|
||||
"infile" |
|
||||
"informat" |
|
||||
"inner" |
|
||||
"input" |
|
||||
"insert" |
|
||||
"intersect" |
|
||||
"keep" |
|
||||
"keylabel" |
|
||||
"label" |
|
||||
"lable" |
|
||||
"legend" |
|
||||
"length" |
|
||||
"libname" |
|
||||
"lineqs" |
|
||||
"link" |
|
||||
"list" |
|
||||
"listing" |
|
||||
"log" |
|
||||
"lostcard" |
|
||||
"low" |
|
||||
"mark" |
|
||||
"matings" |
|
||||
"mean" |
|
||||
"merge" |
|
||||
"missing" |
|
||||
"missover" |
|
||||
"mod" |
|
||||
"model" |
|
||||
"modify" |
|
||||
"n" |
|
||||
"nocell" |
|
||||
"nocharacters" |
|
||||
"nodupkey" |
|
||||
"noexpandtabs" |
|
||||
"noframe" |
|
||||
"noheading" |
|
||||
"noinput" |
|
||||
"nolegend" |
|
||||
"nopad" |
|
||||
"noprint" |
|
||||
"nosharebuffers" |
|
||||
"not" |
|
||||
"note" |
|
||||
"notitle" |
|
||||
"notitles" |
|
||||
"notsorted" |
|
||||
"ods" |
|
||||
"old" |
|
||||
"option" |
|
||||
"or" |
|
||||
"order" |
|
||||
"orderby" |
|
||||
"other" |
|
||||
"otherwise" |
|
||||
"outer" |
|
||||
"output" |
|
||||
"over" |
|
||||
"overlay" |
|
||||
"overprint" |
|
||||
"pad" |
|
||||
"pageby" |
|
||||
"pagesize" |
|
||||
"parmcards" |
|
||||
"parmcards4" |
|
||||
"parms" |
|
||||
"pattern" |
|
||||
"pct" |
|
||||
"pctn" |
|
||||
"pctsum" |
|
||||
"picture" |
|
||||
"pie" |
|
||||
"pie3d" |
|
||||
"plotter" |
|
||||
"predict" |
|
||||
"prefix" |
|
||||
"printer" |
|
||||
"proc" |
|
||||
"ps" |
|
||||
"put" |
|
||||
"quit" |
|
||||
"random" |
|
||||
"range" |
|
||||
"remove" |
|
||||
"rename" |
|
||||
"response" |
|
||||
"replace" |
|
||||
"reset" |
|
||||
"retain" |
|
||||
"return" |
|
||||
"rsubmit" |
|
||||
"run" |
|
||||
"s2" |
|
||||
"select" |
|
||||
"set" |
|
||||
"sharebuffers" |
|
||||
"signoff" |
|
||||
"signon" |
|
||||
"sim" |
|
||||
"skip" |
|
||||
"source2" |
|
||||
"startsas" |
|
||||
"std" |
|
||||
"stop" |
|
||||
"stopover" |
|
||||
"strata" |
|
||||
"sum" |
|
||||
"sumby" |
|
||||
"supvar" |
|
||||
"symbol" |
|
||||
"table" |
|
||||
"tables" |
|
||||
"tape" |
|
||||
"terminal" |
|
||||
"test" |
|
||||
"then" |
|
||||
"time" |
|
||||
"title" |
|
||||
"to" |
|
||||
"transform" |
|
||||
"treatments" |
|
||||
"truncover" |
|
||||
"unbuf" |
|
||||
"unbuffered" |
|
||||
"union" |
|
||||
"until" |
|
||||
"update" |
|
||||
"validate" |
|
||||
"value" |
|
||||
"var" |
|
||||
"variables" |
|
||||
"vaxis" |
|
||||
"vbar" |
|
||||
"weight" |
|
||||
"when" |
|
||||
"where" |
|
||||
"while" |
|
||||
"with" |
|
||||
"window" |
|
||||
"x" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* Base SAS procs. */
|
||||
"append" |
|
||||
"calendar" |
|
||||
"catalog" |
|
||||
"chart" |
|
||||
"cimport" |
|
||||
"compare" |
|
||||
"contents" |
|
||||
"copy" |
|
||||
"cpm" |
|
||||
"cport" |
|
||||
"datasets" |
|
||||
"display" |
|
||||
"explode" |
|
||||
"export" |
|
||||
"fontreg" |
|
||||
"format" |
|
||||
"forms" |
|
||||
"fslist" |
|
||||
"import" |
|
||||
"means" |
|
||||
"migrate" |
|
||||
"options" |
|
||||
"optload" |
|
||||
"optsave" |
|
||||
"plot" |
|
||||
"pmenu" |
|
||||
"print" |
|
||||
"printto" |
|
||||
"proto" |
|
||||
"prtdef" |
|
||||
"prtexp" |
|
||||
"pwencode" |
|
||||
"rank" |
|
||||
"registry" |
|
||||
"report" |
|
||||
"sort" |
|
||||
"sql" |
|
||||
"standard" |
|
||||
"summary" |
|
||||
"tabulate" |
|
||||
"template" |
|
||||
"timeplot" |
|
||||
"transpose" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* SAS/STAT procs. */
|
||||
"corr" |
|
||||
"freq" |
|
||||
"univariate" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
/* Macros. */
|
||||
"%abort" |
|
||||
"%bquote" |
|
||||
"%by" |
|
||||
"%cms" |
|
||||
"%copy" |
|
||||
"%display" |
|
||||
"%do" |
|
||||
"%else" |
|
||||
"%end" |
|
||||
"%eval" |
|
||||
"%global" |
|
||||
"%go" |
|
||||
"%goto" |
|
||||
"%if" |
|
||||
"%inc" |
|
||||
"%include" |
|
||||
"%index" |
|
||||
"%input" |
|
||||
"%keydef" |
|
||||
"%length" |
|
||||
"%let" |
|
||||
"%local" |
|
||||
"%macro" |
|
||||
"%mend" |
|
||||
"%nrbquote" |
|
||||
"%nrquote" |
|
||||
"%nrstr" |
|
||||
"%put" |
|
||||
"%qscan" |
|
||||
"%qsubstr" |
|
||||
"%qsysfunc" |
|
||||
"%quote" |
|
||||
"%qupcase" |
|
||||
"%scan" |
|
||||
"%str" |
|
||||
"%substr" |
|
||||
"%superq" |
|
||||
"%syscall" |
|
||||
"%sysevalf" |
|
||||
"%sysexec" |
|
||||
"%sysfunc" |
|
||||
"%sysget" |
|
||||
"%sysprod" |
|
||||
"%sysrput" |
|
||||
"%then" |
|
||||
"%to" |
|
||||
"%tso" |
|
||||
"%unquote" |
|
||||
"%until" |
|
||||
"%upcase" |
|
||||
"%while" |
|
||||
"%window" { addToken(Token.FUNCTION); }
|
||||
|
||||
}
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
/* Comments. */
|
||||
/* Do comments before operators as "*" can signify a line comment as */
|
||||
/* well as an operator. */
|
||||
^[ \t]*{LineCommentBegin} {
|
||||
// We must do this because of how we
|
||||
// abuse JFlex; since we return an entire
|
||||
// list of tokens at once instead of a
|
||||
// single token at a time, the "^" regex
|
||||
// character doesn't really work, so we must
|
||||
// check that we're at the beginning of a
|
||||
// line ourselves.
|
||||
start = zzStartRead;
|
||||
// Might not be any whitespace.
|
||||
if (yylength()>1) {
|
||||
addToken(zzStartRead,zzMarkedPos-2, Token.WHITESPACE);
|
||||
zzStartRead = zzMarkedPos-1;
|
||||
}
|
||||
// Remember: zzStartRead may now be updated,
|
||||
// so we must check against 'start'.
|
||||
if (start==s.offset) {
|
||||
addToken(zzStartRead,zzEndRead, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
else {
|
||||
addToken(zzStartRead,zzStartRead, Token.OPERATOR);
|
||||
}
|
||||
}
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
|
||||
/* Do operators before identifiers since some of them are words. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{MacroVariable} { addToken(Token.VARIABLE); }
|
||||
{Semicolon} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
{StringBoundary} { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
{CharBoundary} { start = zzMarkedPos-1; yybegin(CHAR); }
|
||||
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as OK; */
|
||||
/* This will include "." from statements like "from lib.dataset". */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<STRING> {
|
||||
|
||||
[^\n\"]+ {}
|
||||
{LineTerminator} { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
/* {StringBoundary}{StringBoundary} {} */
|
||||
{StringBoundary} { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<CHAR> {
|
||||
|
||||
[^\n\']+ {}
|
||||
{LineTerminator} { yybegin(YYINITIAL); addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
/* {CharBoundary}{CharBoundary} {} */
|
||||
{CharBoundary} { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^\n\*]+ {}
|
||||
{LineTerminator} { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,473 +0,0 @@
|
||||
/*
|
||||
* 02/15/2005
|
||||
*
|
||||
* SQLTokenMaker.java - Scanner for SQL.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class generates tokens representing a text stream as SQL.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>SQLTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class SQLTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public SQLTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overridden to return <code>true</code> so paren matching occurs for
|
||||
* SQL.
|
||||
*
|
||||
* @return <code>true</code> always.
|
||||
*/
|
||||
@Override
|
||||
public boolean getCurlyBracesDenoteCodeBlocks(int languageIndex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "--", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
LineTerminator = ([\n])
|
||||
Letter = ([A-Za-z])
|
||||
Digit = ([0-9])
|
||||
Whitespace = ([ \t]+)
|
||||
|
||||
IdentifierStart = ({Letter})
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|[_])
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
|
||||
Operator = (">="|"<="|"<>"|">"|"<"|"="|"+"|"-"|"*"|"/")
|
||||
Separator = ([\(\)])
|
||||
|
||||
Parameter = ([:]{Identifier})
|
||||
|
||||
Integer = ({Digit}+)
|
||||
Float = (({Digit}+[.]{Digit}*)|([.]{Digit}*))
|
||||
ApproxNum = (({Digit}+[eE][+-]?{Digit}+)|({Digit}+[.]{Digit}*[eE][+-]?[0-9]+)|([.][0-9]*[eE][+-]?[0-9]+))
|
||||
|
||||
CommentBegin = ("--")
|
||||
Comment = ({CommentBegin}.*)
|
||||
MLCBegin = "/*"
|
||||
MLCEnd = "*/"
|
||||
|
||||
%state STRING
|
||||
%state CHAR
|
||||
%state MLC
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"ADD" |
|
||||
"ALL" |
|
||||
"ALTER" |
|
||||
"AND" |
|
||||
"ANY" |
|
||||
"AS" |
|
||||
"ASC" |
|
||||
"AUTOINCREMENT" |
|
||||
"AVA" |
|
||||
"BETWEEN" |
|
||||
"BINARY" |
|
||||
"BIT" |
|
||||
"BOOLEAN" |
|
||||
"BY" |
|
||||
"BYTE" |
|
||||
"CHAR" |
|
||||
"CHARACTER" |
|
||||
"COLUMN" |
|
||||
"CONSTRAINT" |
|
||||
"COUNT" |
|
||||
"COUNTER" |
|
||||
"CREATE" |
|
||||
"CURRENCY" |
|
||||
"DATABASE" |
|
||||
"DATE" |
|
||||
"DATETIME" |
|
||||
"DELETE" |
|
||||
"DESC" |
|
||||
"DISALLOW" |
|
||||
"DISTINCT" |
|
||||
"DISTINCTROW" |
|
||||
"DOUBLE" |
|
||||
"DROP" |
|
||||
"EXISTS" |
|
||||
"FLOAT" |
|
||||
"FLOAT4" |
|
||||
"FLOAT8" |
|
||||
"FOREIGN" |
|
||||
"FROM" |
|
||||
"GENERAL" |
|
||||
"GROUP" |
|
||||
"GUID" |
|
||||
"HAVING" |
|
||||
"INNER" |
|
||||
"INSERT" |
|
||||
"IGNORE" |
|
||||
"IMP" |
|
||||
"IN" |
|
||||
"INDEX" |
|
||||
"INT" |
|
||||
"INTEGER" |
|
||||
"INTEGER1" |
|
||||
"INTEGER2" |
|
||||
"INTEGER4" |
|
||||
"INTO" |
|
||||
"IS" |
|
||||
"JOIN" |
|
||||
"KEY" |
|
||||
"LEFT" |
|
||||
"LEVEL" |
|
||||
"LIKE" |
|
||||
"LOGICAL" |
|
||||
"LONG" |
|
||||
"LONGBINARY" |
|
||||
"LONGTEXT" |
|
||||
"MAX" |
|
||||
"MEMO" |
|
||||
"MIN" |
|
||||
"MOD" |
|
||||
"MONEY" |
|
||||
"NOT" |
|
||||
"NULL" |
|
||||
"NUMBER" |
|
||||
"NUMERIC" |
|
||||
"OLEOBJECT" |
|
||||
"ON" |
|
||||
"OPTION" |
|
||||
"OR" |
|
||||
"ORDER" |
|
||||
"OUTER" |
|
||||
"OWNERACCESS" |
|
||||
"PARAMETERS" |
|
||||
"PASSWORD" |
|
||||
"PERCENT" |
|
||||
"PIVOT" |
|
||||
"PRIMARY" |
|
||||
"REAL" |
|
||||
"REFERENCES" |
|
||||
"RIGHT" |
|
||||
"SELECT" |
|
||||
"SET" |
|
||||
"SHORT" |
|
||||
"SINGLE" |
|
||||
"SMALLINT" |
|
||||
"SOME" |
|
||||
"STDEV" |
|
||||
"STDEVP" |
|
||||
"STRING" |
|
||||
"SUM" |
|
||||
"TABLE" |
|
||||
"TABLEID" |
|
||||
"TEXT" |
|
||||
"TIME" |
|
||||
"TIMESTAMP" |
|
||||
"TOP" |
|
||||
"TRANSFORM" |
|
||||
"TYPE" |
|
||||
"UNION" |
|
||||
"UNIQUE" |
|
||||
"UPDATE" |
|
||||
"USER" |
|
||||
"VALUE" |
|
||||
"VALUES" |
|
||||
"VAR" |
|
||||
"VARBINARY" |
|
||||
"VARCHAR" |
|
||||
"VARP" |
|
||||
"WHERE" |
|
||||
"WITH" |
|
||||
"YESNO" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
/* SQL99 aggregate functions */
|
||||
"AVG" |
|
||||
"COUNT" |
|
||||
"MIN" |
|
||||
"MAX" |
|
||||
"SUM" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* SQL99 built-in scalar functions */
|
||||
"CURRENT_DATE" |
|
||||
"CURRENT_TIME" |
|
||||
"CURRENT_TIMESTAMP" |
|
||||
"CURRENT_USER" |
|
||||
"SESSION_USER" |
|
||||
"SYSTEM_USER" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* SQL99 numeric scalar functions */
|
||||
"BIT_LENGTH" |
|
||||
"CHAR_LENGTH" |
|
||||
"EXTRACT" |
|
||||
"OCTET_LENGTH" |
|
||||
"POSITION" { addToken(Token.FUNCTION); }
|
||||
|
||||
/* SQL99 string functions */
|
||||
"CONCATENATE" |
|
||||
"CONVERT" |
|
||||
"LOWER" |
|
||||
"SUBSTRING" |
|
||||
"TRANSLATE" |
|
||||
"TRIM" |
|
||||
"UPPER" { addToken(Token.FUNCTION); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
";" { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{Parameter} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{Comment} { addToken(Token.COMMENT_EOL); }
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
|
||||
{Integer} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{Float} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ApproxNum} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
|
||||
"\"" { start = zzMarkedPos-1; yybegin(STRING); }
|
||||
"\'" { start = zzMarkedPos-1; yybegin(CHAR); }
|
||||
|
||||
"["[^\]]*"]" { addToken(Token.PREPROCESSOR); }
|
||||
"["[^\]]* { addToken(Token.ERROR_IDENTIFIER); addNullToken(); return firstToken; }
|
||||
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as OK; */
|
||||
/* I don't know enough about SQL to know what's really invalid. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<STRING> {
|
||||
|
||||
[^\n\"]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
"\"\"" {}
|
||||
"\"" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<CHAR> {
|
||||
|
||||
[^\n\']+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
"\'\'" {}
|
||||
"\'" { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
|
||||
|
||||
}
|
||||
|
||||
<MLC> {
|
||||
|
||||
[^\n\*]+ {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
|
||||
}
|
||||
@@ -1,932 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 6/29/14 12:25 AM */
|
||||
/*
|
||||
* 02/15/2005
|
||||
* SQLTokenMaker.java - Scanner for SQL.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* This class generates tokens representing a text stream as SQL.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>SQLTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class SQLTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int STRING = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int MLC = 3;
|
||||
public static final int CHAR = 2;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\4\1\1\25\0\1\4\1\0\1\54\4\0\1\55\2\15"
|
||||
+ "\1\13\1\11\1\0\1\12\1\17\1\14\1\3\1\50\1\50\1\3" + "\1\45\3\3\1\46\1\3\1\16\1\0\1\10\1\7\1\6\2\0"
|
||||
+ "\1\21\1\37\1\31\1\22\1\20\1\44\1\47\1\41\1\34\1\51"
|
||||
+ "\1\52\1\23\1\35\1\26\1\33\1\42\1\53\1\25\1\30\1\24" + "\1\32\1\36\1\40\1\43\1\27\1\2\1\56\1\0\1\57\1\0"
|
||||
+ "\1\5\1\0\1\21\1\37\1\31\1\22\1\20\1\44\1\47\1\41" + "\1\34\1\51\1\52\1\23\1\35\1\26\1\33\1\42\1\53\1\25"
|
||||
+ "\1\30\1\24\1\32\1\36\1\40\1\43\1\27\1\2\uff85\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\4\0\1\1\1\2\1\1\1\3\1\4\5\5\1\6"
|
||||
+ "\1\1\1\7\27\1\1\10\1\11\1\12\1\13\1\14" + "\1\15\1\13\1\16\1\17\1\13\1\20\1\13\1\0"
|
||||
+ "\1\21\1\22\4\1\1\23\45\1\2\23\4\1\1\23" + "\7\1\1\23\22\1\1\24\1\13\1\25\1\7\1\0"
|
||||
+ "\3\1\1\26\51\1\1\23\4\1\1\23\2\1\1\23" + "\22\1\1\23\4\1\1\23\4\1\1\23\17\1\1\23"
|
||||
+ "\35\1\1\23\5\1\1\23\10\1\1\23\5\1\1\23" + "\11\1\1\23\42\1\1\23\4\1\1\23\16\1\1\26" + "\4\1";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[354];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\60\0\140\0\220\0\300\0\300\0\360\0\u0120"
|
||||
+ "\0\u0150\0\u0180\0\300\0\u01b0\0\u01e0\0\u0210\0\300\0\u0240"
|
||||
+ "\0\u0270\0\u02a0\0\u02d0\0\u0300\0\u0330\0\u0360\0\u0390\0\u03c0"
|
||||
+ "\0\u03f0\0\u0420\0\u0450\0\u0480\0\u04b0\0\u04e0\0\u0510\0\u0540"
|
||||
+ "\0\u0570\0\u05a0\0\u05d0\0\u0600\0\u0630\0\u0660\0\u0690\0\u06c0"
|
||||
+ "\0\300\0\300\0\u06f0\0\u0720\0\300\0\u0750\0\u0780\0\300"
|
||||
+ "\0\u07b0\0\u07e0\0\300\0\u0810\0\u0840\0\u0870\0\300\0\u08a0"
|
||||
+ "\0\u08d0\0\u0900\0\u0930\0\u0960\0\u0990\0\u09c0\0\u09f0\0\u0a20"
|
||||
+ "\0\u0a50\0\u0a80\0\u0ab0\0\u0ae0\0\u0b10\0\u0b40\0\u0b70\0\u0ba0"
|
||||
+ "\0\u0bd0\0\u0c00\0\u0c30\0\u0c60\0\u0c90\0\u0cc0\0\u0cf0\0\u0d20"
|
||||
+ "\0\u0d50\0\u0d80\0\u0db0\0\u0de0\0\u0e10\0\u0e40\0\u0e70\0\u0ea0"
|
||||
+ "\0\u0ed0\0\u0f00\0\u0f30\0\u0f60\0\u0f90\0\u0fc0\0\u0ff0\0\u1020"
|
||||
+ "\0\u1050\0\u1080\0\360\0\u10b0\0\u10e0\0\u1110\0\u1140\0\u1170"
|
||||
+ "\0\u11a0\0\u11d0\0\u1200\0\u1230\0\u1260\0\u1290\0\u12c0\0\u12f0"
|
||||
+ "\0\u1320\0\u1350\0\u1380\0\u13b0\0\u13e0\0\u1410\0\u1440\0\u1470"
|
||||
+ "\0\u14a0\0\u14d0\0\u1500\0\u1530\0\u1560\0\u1590\0\u15c0\0\u15f0"
|
||||
+ "\0\u1620\0\u1650\0\300\0\300\0\300\0\u1680\0\u1680\0\u16b0"
|
||||
+ "\0\u16e0\0\u1710\0\360\0\u1740\0\u0960\0\u1770\0\u17a0\0\u17d0"
|
||||
+ "\0\u1800\0\u1830\0\u1860\0\u1890\0\u18c0\0\u18f0\0\u1920\0\u1950"
|
||||
+ "\0\u1980\0\u19b0\0\u19e0\0\u1a10\0\u1a40\0\u1a70\0\u1aa0\0\u1ad0"
|
||||
+ "\0\u1b00\0\u1b30\0\u1b60\0\u1b90\0\u1bc0\0\u1bf0\0\u1c20\0\u1c50"
|
||||
+ "\0\u1c80\0\u1cb0\0\u1ce0\0\u1d10\0\u1d40\0\u1d70\0\u1da0\0\u1dd0"
|
||||
+ "\0\u1e00\0\u1e30\0\u1e60\0\u1e90\0\u1ec0\0\u1ef0\0\u1f20\0\u1f50"
|
||||
+ "\0\u1f80\0\u1fb0\0\u1fe0\0\u2010\0\u2040\0\u2070\0\u20a0\0\u20d0"
|
||||
+ "\0\u2100\0\u2130\0\u2160\0\u2190\0\u21c0\0\u21f0\0\u2220\0\u2250"
|
||||
+ "\0\u2280\0\u22b0\0\u22e0\0\u2310\0\u2340\0\u2370\0\u12f0\0\u23a0"
|
||||
+ "\0\u23d0\0\u2400\0\u2430\0\u2460\0\u2490\0\u24c0\0\u24f0\0\u2520"
|
||||
+ "\0\u2550\0\u2580\0\u25b0\0\u25e0\0\u2610\0\u2640\0\u2670\0\u26a0"
|
||||
+ "\0\u26d0\0\u2700\0\u2730\0\u2760\0\u2790\0\u27c0\0\u27f0\0\u2820"
|
||||
+ "\0\u2850\0\u2880\0\u28b0\0\u28e0\0\u2910\0\u2940\0\u2970\0\u29a0"
|
||||
+ "\0\u29d0\0\u2a00\0\u2a30\0\u2a60\0\u2a90\0\u2ac0\0\u2af0\0\u2b20"
|
||||
+ "\0\u2b50\0\u2b80\0\u2bb0\0\u2be0\0\u2c10\0\u2c40\0\u2c70\0\u2ca0"
|
||||
+ "\0\u2cd0\0\u2d00\0\u2d30\0\u2d60\0\u2d90\0\u2dc0\0\u2df0\0\u15f0"
|
||||
+ "\0\u2e20\0\u2e50\0\u2e80\0\u2eb0\0\u2ee0\0\u0c30\0\u2f10\0\u2f40"
|
||||
+ "\0\u2f70\0\u2fa0\0\u2fd0\0\u3000\0\u3030\0\u3060\0\u0ff0\0\u3090"
|
||||
+ "\0\u30c0\0\u2040\0\u30f0\0\u3120\0\u2ca0\0\u3150\0\u3180\0\u31b0"
|
||||
+ "\0\u31e0\0\u3210\0\u3240\0\u3270\0\u32a0\0\u32d0\0\u3300\0\u3330"
|
||||
+ "\0\u3360\0\u3390\0\u33c0\0\u33f0\0\u3420\0\u3450\0\u3480\0\u34b0"
|
||||
+ "\0\u34e0\0\u3510\0\u3540\0\u3570\0\u35a0\0\u35d0\0\u3600\0\u3630"
|
||||
+ "\0\u3660\0\u3690\0\u36c0\0\u36f0\0\u3720\0\u3750\0\u3780\0\u37b0"
|
||||
+ "\0\u37e0\0\u3810\0\u3840\0\u3870\0\u38a0\0\u38d0\0\u3900\0\u3930"
|
||||
+ "\0\u3960\0\u3990\0\u39c0\0\u39f0\0\u3a20\0\u3a50\0\u3a80\0\u3ab0"
|
||||
+ "\0\u3ae0\0\u3b10\0\u3b40\0\u3b70\0\u3ba0\0\u3bd0\0\u3c00\0\u3c30"
|
||||
+ "\0\u3c60\0\u3c90\0\u3cc0\0\u3cf0\0\u3d20\0\u3d50\0\u3d80\0\u3db0" + "\0\u3de0\0\u3e10";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[354];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\5\1\6\1\7\1\10\1\11\1\5\1\12\1\13"
|
||||
+ "\1\14\1\13\1\15\1\13\1\16\1\17\1\20\1\21" + "\1\22\1\23\1\24\1\25\1\26\1\27\1\30\1\31"
|
||||
+ "\1\32\1\33\1\34\1\35\1\36\1\37\1\40\1\41" + "\1\42\1\43\1\44\1\7\1\45\2\10\1\46\1\10"
|
||||
+ "\1\47\1\50\1\7\1\51\1\52\1\53\1\5\1\54" + "\1\55\52\54\1\56\3\54\1\57\1\60\53\57\1\61"
|
||||
+ "\2\57\1\62\1\63\11\62\1\64\44\62\62\0\2\7" + "\1\0\1\7\12\0\34\7\7\0\1\10\13\0\1\21"
|
||||
+ "\1\65\24\0\2\10\1\0\1\10\13\0\1\11\62\0" + "\1\13\56\0\2\13\62\0\1\66\60\0\1\67\46\0"
|
||||
+ "\1\7\15\0\25\7\2\0\1\7\1\0\3\7\7\0" + "\1\21\14\0\1\65\24\0\2\21\1\0\1\21\11\0"
|
||||
+ "\2\7\1\0\1\7\12\0\23\7\1\70\10\7\6\0" + "\2\7\1\0\1\7\12\0\2\7\1\71\1\72\2\7"
|
||||
+ "\1\73\1\7\1\74\1\7\1\75\3\7\1\76\15\7" + "\6\0\2\7\1\0\1\7\12\0\1\77\1\100\3\7"
|
||||
+ "\1\101\5\7\1\102\1\103\17\7\6\0\2\7\1\0" + "\1\7\12\0\1\104\12\7\1\105\1\106\17\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\1\107\1\110\3\7\1\111" + "\1\7\1\112\3\7\1\113\1\114\17\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\1\115\13\7\1\116\17\7\6\0" + "\2\7\1\0\1\7\12\0\12\7\1\117\1\120\20\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\1\121\33\7\6\0" + "\2\7\1\0\1\7\12\0\1\122\3\7\1\123\2\7"
|
||||
+ "\1\124\2\7\1\125\1\126\1\127\1\130\3\7\1\131" + "\12\7\6\0\2\7\1\0\1\7\12\0\5\7\1\132"
|
||||
+ "\4\7\1\133\1\134\5\7\1\135\12\7\6\0\2\7" + "\1\0\1\7\12\0\6\7\1\136\1\7\1\137\11\7"
|
||||
+ "\1\140\11\7\6\0\2\7\1\0\1\7\12\0\3\7" + "\1\141\1\7\1\142\1\143\2\7\1\144\1\145\5\7"
|
||||
+ "\1\146\1\7\1\147\11\7\6\0\2\7\1\0\1\7" + "\12\0\6\7\1\150\1\7\1\143\4\7\1\113\11\7"
|
||||
+ "\1\151\4\7\6\0\2\7\1\0\1\7\12\0\1\152" + "\1\153\11\7\1\154\1\155\17\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\7\1\156\32\7\6\0\2\7\1\0" + "\1\7\12\0\1\157\6\7\1\160\3\7\1\161\1\162"
|
||||
+ "\17\7\6\0\2\7\1\0\1\7\12\0\14\7\1\163" + "\4\7\1\164\12\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\1\7\1\165\32\7\6\0\2\7\1\0\1\7\12\0" + "\1\166\1\167\3\7\1\170\5\7\1\171\1\172\17\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\3\7\1\173\1\7" + "\1\174\5\7\1\175\20\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\1\176\4\7\1\177\4\7\1\200\21\7\6\0" + "\2\7\1\0\1\7\12\0\13\7\1\201\20\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\1\202\33\7\4\0\57\53" + "\1\203\1\54\1\0\52\54\1\0\3\54\54\0\1\204"
|
||||
+ "\3\0\1\57\1\0\53\57\1\0\2\57\55\0\1\204" + "\2\0\1\62\1\0\11\62\1\0\44\62\14\0\1\205"
|
||||
+ "\46\0\1\206\5\0\2\207\32\0\2\206\1\0\1\206" + "\7\0\1\66\1\0\56\66\2\0\2\7\1\0\1\7"
|
||||
+ "\12\0\4\7\1\210\7\7\1\211\17\7\6\0\2\7" + "\1\0\1\7\12\0\2\7\1\143\31\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\3\7\1\143\1\137\27\7\6\0" + "\2\7\1\0\1\7\12\0\2\7\1\143\4\7\1\143"
|
||||
+ "\24\7\6\0\2\7\1\0\1\7\12\0\11\7\1\143" + "\22\7\6\0\2\7\1\0\1\7\12\0\4\7\1\212"
|
||||
+ "\27\7\6\0\2\7\1\0\1\7\12\0\1\7\1\143" + "\25\7\1\213\4\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\3\7\1\214\4\7\1\215\23\7\6\0\2\7\1\0" + "\1\7\12\0\4\7\1\216\27\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\13\7\1\113\20\7\6\0\2\7\1\0" + "\1\7\12\0\12\7\1\217\21\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\10\7\1\220\23\7\6\0\2\7\1\0" + "\1\7\12\0\16\7\1\221\5\7\1\120\7\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\6\7\1\222\11\7\1\223" + "\6\7\1\224\4\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\32\7\1\225\1\7\6\0\2\7\1\0\1\7\12\0" + "\23\7\1\120\10\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\17\7\1\226\14\7\6\0\2\7\1\0\1\7\12\0" + "\1\7\1\227\12\7\1\230\17\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\22\7\1\225\11\7\6\0\2\7\1\0" + "\1\7\12\0\22\7\1\143\11\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\15\7\1\231\16\7\6\0\2\7\1\0" + "\1\7\12\0\1\7\1\232\22\7\1\233\7\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\27\7\1\234\4\7\6\0" + "\2\7\1\0\1\7\12\0\3\7\1\232\11\7\1\235"
|
||||
+ "\16\7\6\0\2\7\1\0\1\7\12\0\4\7\1\143" + "\27\7\6\0\2\7\1\0\1\7\12\0\10\7\1\236"
|
||||
+ "\23\7\6\0\2\7\1\0\1\7\12\0\3\7\1\237" + "\1\143\3\7\1\240\23\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\2\7\1\241\2\7\1\242\26\7\6\0\2\7" + "\1\0\1\7\12\0\10\7\1\243\23\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\15\7\1\143\1\7\1\244\14\7" + "\6\0\2\7\1\0\1\7\12\0\15\7\1\225\16\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\6\7\1\245\25\7" + "\6\0\2\7\1\0\1\7\12\0\1\7\1\246\32\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\13\7\1\247\20\7" + "\6\0\2\7\1\0\1\7\12\0\1\250\33\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\5\7\1\251\26\7\6\0" + "\2\7\1\0\1\7\12\0\3\7\1\252\2\7\1\253"
|
||||
+ "\3\7\1\254\21\7\6\0\2\7\1\0\1\7\12\0" + "\1\7\1\255\32\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\14\7\1\256\17\7\6\0\2\7\1\0\1\7\12\0" + "\1\257\33\7\6\0\2\7\1\0\1\7\12\0\2\7"
|
||||
+ "\1\250\17\7\1\223\11\7\6\0\2\7\1\0\1\7" + "\12\0\1\260\33\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\2\7\1\137\31\7\6\0\2\7\1\0\1\7\12\0" + "\4\7\1\261\27\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\4\7\1\137\27\7\6\0\2\7\1\0\1\7\12\0" + "\6\7\1\262\25\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\4\7\1\263\27\7\6\0\2\7\1\0\1\7\12\0" + "\2\7\1\264\1\7\1\265\1\7\1\137\1\7\1\266"
|
||||
+ "\23\7\6\0\2\7\1\0\1\7\12\0\6\7\1\267" + "\25\7\6\0\2\7\1\0\1\7\12\0\15\7\1\270"
|
||||
+ "\16\7\6\0\2\7\1\0\1\7\12\0\23\7\1\143" + "\10\7\6\0\2\7\1\0\1\7\12\0\2\7\1\143"
|
||||
+ "\3\7\1\50\25\7\6\0\2\7\1\0\1\7\12\0" + "\6\7\1\143\25\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\3\7\1\271\1\7\1\272\26\7\6\0\2\7\1\0" + "\1\7\12\0\4\7\1\273\27\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\4\7\1\225\27\7\6\0\2\7\1\0" + "\1\7\12\0\13\7\1\274\20\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\4\7\1\275\1\7\1\276\25\7\6\0" + "\2\7\1\0\1\7\12\0\4\7\1\277\27\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\1\300\33\7\6\0\2\7" + "\1\0\1\7\12\0\16\7\1\242\15\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\5\7\1\301\26\7\6\0\2\7" + "\1\0\1\7\12\0\5\7\1\302\2\7\1\303\23\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\14\7\1\304\17\7" + "\6\0\2\7\1\0\1\7\12\0\10\7\1\305\23\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\16\7\1\306\15\7" + "\6\0\2\7\1\0\1\7\12\0\13\7\1\307\20\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\13\7\1\310\20\7" + "\6\0\2\7\1\0\1\7\12\0\5\7\1\311\26\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\6\7\1\312\25\7" + "\6\0\2\7\1\0\1\7\12\0\13\7\1\313\20\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\14\7\1\71\17\7" + "\6\0\2\7\1\0\1\7\12\0\14\7\1\155\17\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\7\7\1\143\24\7" + "\7\0\1\206\41\0\2\206\1\0\1\206\11\0\2\7"
|
||||
+ "\1\0\1\7\12\0\5\7\1\314\26\7\6\0\2\7" + "\1\0\1\7\12\0\10\7\1\315\23\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\13\7\1\316\20\7\6\0\2\7" + "\1\0\1\7\12\0\1\317\33\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\320\1\321\32\7\6\0\2\7\1\0" + "\1\7\12\0\17\7\1\322\14\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\7\1\323\2\7\1\324\27\7\6\0" + "\2\7\1\0\1\7\12\0\1\232\33\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\27\7\1\325\4\7\6\0\2\7" + "\1\0\1\7\12\0\1\326\33\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\14\7\1\327\17\7\6\0\2\7\1\0" + "\1\7\12\0\1\143\33\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\3\7\1\330\30\7\6\0\2\7\1\0\1\7" + "\12\0\6\7\1\331\25\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\15\7\1\213\16\7\6\0\2\7\1\0\1\7" + "\12\0\1\332\33\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\3\7\1\143\30\7\6\0\2\7\1\0\1\7\12\0" + "\1\333\33\7\6\0\2\7\1\0\1\7\12\0\21\7"
|
||||
+ "\1\120\12\7\6\0\2\7\1\0\1\7\12\0\1\334" + "\16\7\1\137\14\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\6\7\1\270\25\7\6\0\2\7\1\0\1\7\12\0" + "\1\335\33\7\6\0\2\7\1\0\1\7\12\0\10\7"
|
||||
+ "\1\336\23\7\6\0\2\7\1\0\1\7\12\0\1\337" + "\33\7\6\0\2\7\1\0\1\7\12\0\14\7\1\340"
|
||||
+ "\17\7\6\0\2\7\1\0\1\7\12\0\4\7\1\341" + "\27\7\6\0\2\7\1\0\1\7\12\0\10\7\1\342"
|
||||
+ "\23\7\6\0\2\7\1\0\1\7\12\0\27\7\1\322" + "\4\7\6\0\2\7\1\0\1\7\12\0\3\7\1\343"
|
||||
+ "\30\7\6\0\2\7\1\0\1\7\12\0\5\7\1\120" + "\26\7\6\0\2\7\1\0\1\7\12\0\1\7\1\317"
|
||||
+ "\32\7\6\0\2\7\1\0\1\7\12\0\5\7\1\344" + "\26\7\6\0\2\7\1\0\1\7\12\0\12\7\1\345"
|
||||
+ "\21\7\6\0\2\7\1\0\1\7\12\0\10\7\1\346" + "\1\347\4\7\1\350\15\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\6\7\1\351\25\7\6\0\2\7\1\0\1\7" + "\12\0\5\7\1\352\26\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\13\7\1\155\17\7\1\353\6\0\2\7\1\0" + "\1\7\12\0\5\7\1\143\26\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\13\7\1\354\20\7\6\0\2\7\1\0" + "\1\7\12\0\1\355\33\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\1\356\33\7\6\0\2\7\1\0\1\7\12\0" + "\14\7\1\357\17\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\1\153\33\7\6\0\2\7\1\0\1\7\12\0\1\360" + "\12\7\1\143\20\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\1\247\33\7\6\0\2\7\1\0\1\7\12\0\13\7" + "\1\300\20\7\6\0\2\7\1\0\1\7\12\0\13\7"
|
||||
+ "\1\143\20\7\6\0\2\7\1\0\1\7\12\0\12\7" + "\1\361\21\7\6\0\2\7\1\0\1\7\12\0\11\7"
|
||||
+ "\1\362\5\7\1\363\2\7\1\143\11\7\6\0\2\7" + "\1\0\1\7\12\0\20\7\1\364\13\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\3\7\1\365\30\7\6\0\2\7" + "\1\0\1\366\12\0\34\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\1\7\1\367\32\7\6\0\2\7\1\0\1\7" + "\12\0\21\7\1\143\12\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\5\7\1\225\26\7\6\0\2\7\1\0\1\7" + "\12\0\11\7\1\370\22\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\1\7\1\371\32\7\6\0\2\7\1\0\1\7" + "\12\0\10\7\1\372\23\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\15\7\1\276\16\7\6\0\2\7\1\0\1\7" + "\12\0\14\7\1\373\17\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\13\7\1\120\20\7\6\0\2\7\1\0\1\7" + "\12\0\1\7\1\374\32\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\15\7\1\143\16\7\6\0\2\7\1\0\1\7" + "\12\0\1\375\33\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\1\376\33\7\6\0\2\7\1\0\1\7\12\0\12\7" + "\1\113\21\7\6\0\2\7\1\0\1\7\12\0\1\7"
|
||||
+ "\1\377\32\7\6\0\2\7\1\0\1\7\12\0\4\7" + "\1\u0100\27\7\6\0\2\7\1\0\1\7\12\0\14\7"
|
||||
+ "\1\u0101\17\7\6\0\2\7\1\0\1\7\12\0\4\7" + "\1\u0102\27\7\6\0\2\7\1\0\1\7\12\0\17\7"
|
||||
+ "\1\u0103\14\7\6\0\2\7\1\0\1\7\12\0\3\7" + "\1\225\30\7\6\0\2\7\1\0\1\7\12\0\3\7"
|
||||
+ "\1\u0104\30\7\6\0\2\7\1\0\1\7\12\0\14\7" + "\1\u0105\17\7\6\0\2\7\1\0\1\7\12\0\4\7"
|
||||
+ "\1\u0106\12\7\1\363\14\7\6\0\2\7\1\0\1\7" + "\12\0\5\7\1\213\26\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\11\7\1\u0107\22\7\6\0\2\7\1\0\1\7" + "\12\0\1\u0108\33\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\10\7\1\u0109\23\7\6\0\2\7\1\0\1\7\12\0" + "\10\7\1\u010a\23\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\5\7\1\u010b\26\7\6\0\2\7\1\0\1\7\12\0" + "\5\7\1\u010c\26\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\11\7\1\120\22\7\6\0\2\7\1\0\1\7\12\0" + "\14\7\1\u010d\17\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\16\7\1\u010e\15\7\6\0\2\7\1\0\1\7\12\0" + "\6\7\1\u010f\25\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\1\u0110\33\7\6\0\2\7\1\0\1\7\12\0\4\7" + "\1\u0111\27\7\6\0\2\7\1\0\1\7\12\0\3\7"
|
||||
+ "\1\u0112\30\7\6\0\2\7\1\0\1\7\12\0\1\u0113" + "\33\7\6\0\2\7\1\0\1\7\12\0\15\7\1\155"
|
||||
+ "\16\7\6\0\2\7\1\0\1\7\12\0\4\7\1\u0114" + "\27\7\6\0\2\7\1\0\1\7\12\0\1\7\1\u0115"
|
||||
+ "\32\7\6\0\2\7\1\0\1\7\12\0\1\u0116\33\7" + "\6\0\2\7\1\0\1\7\12\0\4\7\1\u0117\27\7"
|
||||
+ "\6\0\2\7\1\0\1\366\12\0\1\7\1\u0118\32\7" + "\6\0\2\7\1\0\1\7\12\0\12\7\1\225\21\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\17\7\1\u0119\14\7" + "\6\0\2\7\1\0\1\7\12\0\4\7\1\u011a\27\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\5\7\1\u011b\26\7" + "\6\0\2\7\1\0\1\7\12\0\13\7\1\155\20\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\27\7\1\u011c\4\7" + "\6\0\2\7\1\0\1\7\12\0\1\u011d\33\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\21\7\1\u011e\12\7\6\0" + "\2\7\1\0\1\7\12\0\14\7\1\u011f\17\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\1\u0120\33\7\6\0\2\7" + "\1\0\1\7\12\0\1\u0121\33\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\3\7\1\u0122\30\7\6\0\2\7\1\0" + "\1\7\12\0\5\7\1\202\26\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\u0123\33\7\6\0\2\7\1\0\1\7" + "\12\0\15\7\1\u0124\16\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\20\7\1\u0125\13\7\6\0\2\7\1\0\1\7" + "\12\0\4\7\1\u0126\27\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\4\7\1\u0127\27\7\6\0\2\7\1\0\1\7" + "\12\0\14\7\1\u0128\17\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\5\7\1\u0107\26\7\6\0\2\7\1\0\1\7" + "\12\0\11\7\1\u0129\22\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\10\7\1\143\23\7\6\0\2\7\1\0\1\7" + "\12\0\6\7\1\u012a\25\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\14\7\1\126\17\7\6\0\2\7\1\0\1\7" + "\12\0\1\7\1\u012b\32\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\3\7\1\u012c\30\7\6\0\2\7\1\0\1\7" + "\12\0\6\7\1\u012d\25\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\1\107\33\7\6\0\2\7\1\0\1\7\12\0" + "\1\7\1\232\32\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\3\7\1\u012e\20\7\1\u012f\7\7\6\0\2\7\1\0" + "\1\7\12\0\4\7\1\u0130\27\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\u0131\33\7\6\0\2\7\1\0\1\7" + "\12\0\14\7\1\215\17\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\13\7\1\u0132\20\7\6\0\2\7\1\0\1\7" + "\12\0\27\7\1\143\4\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\15\7\1\u0133\16\7\6\0\2\7\1\0\1\7" + "\12\0\5\7\1\u0134\26\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\14\7\1\u0123\17\7\6\0\2\7\1\0\1\7" + "\12\0\6\7\1\u0135\25\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\5\7\1\u0136\26\7\6\0\2\7\1\0\1\7" + "\12\0\4\7\1\u0137\27\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\5\7\1\u0129\26\7\6\0\2\7\1\0\1\7" + "\12\0\11\7\1\145\22\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\31\7\1\237\2\7\6\0\2\7\1\0\1\7" + "\12\0\1\7\1\u0138\32\7\6\0\2\7\1\0\1\7"
|
||||
+ "\12\0\1\u0139\33\7\6\0\2\7\1\0\1\7\12\0" + "\1\7\1\257\32\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\6\7\1\276\25\7\6\0\2\7\1\0\1\7\12\0" + "\1\155\33\7\6\0\2\7\1\0\1\7\12\0\1\7"
|
||||
+ "\1\155\32\7\6\0\2\7\1\0\1\7\12\0\1\u013a" + "\33\7\6\0\2\7\1\0\1\7\12\0\6\7\1\120"
|
||||
+ "\25\7\6\0\2\7\1\0\1\7\12\0\1\u013b\33\7" + "\6\0\2\7\1\0\1\7\12\0\13\7\1\u013c\20\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\14\7\1\u013d\17\7" + "\6\0\2\7\1\0\1\7\12\0\25\7\2\143\5\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\27\7\1\155\4\7" + "\6\0\2\7\1\0\1\7\12\0\4\7\1\213\27\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\11\7\1\u013e\22\7" + "\6\0\2\7\1\0\1\7\12\0\10\7\1\225\23\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\13\7\1\u013f\20\7" + "\6\0\2\7\1\0\1\7\12\0\11\7\1\u0140\22\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\1\7\1\u0141\32\7" + "\6\0\2\7\1\0\1\7\12\0\13\7\1\u0142\20\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\1\7\1\u0143\32\7" + "\6\0\2\7\1\0\1\7\12\0\6\7\1\u0144\25\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\6\7\1\u0133\25\7" + "\6\0\2\7\1\0\1\u0145\12\0\34\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\14\7\1\u0146\17\7\6\0\2\7" + "\1\0\1\7\12\0\4\7\1\u0147\4\7\1\202\22\7"
|
||||
+ "\6\0\2\7\1\0\1\7\12\0\1\7\1\u0112\32\7" + "\6\0\2\7\1\0\1\7\12\0\1\u0148\33\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\11\7\1\u0149\22\7\6\0" + "\2\7\1\0\1\7\12\0\5\7\1\u014a\26\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\6\7\1\u014b\25\7\6\0" + "\2\7\1\0\1\7\12\0\4\7\1\u014c\27\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\5\7\1\71\26\7\6\0" + "\2\7\1\0\1\7\12\0\13\7\1\u014d\20\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\5\7\1\u014e\26\7\6\0" + "\2\7\1\0\1\7\12\0\20\7\1\143\13\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\4\7\1\u014f\27\7\6\0" + "\2\7\1\0\1\7\12\0\4\7\1\u0150\27\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\5\7\1\310\26\7\6\0" + "\2\7\1\0\1\7\12\0\15\7\1\113\16\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\11\7\1\u0151\22\7\6\0" + "\2\7\1\0\1\7\12\0\12\7\1\u0152\21\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\6\7\1\u0153\25\7\6\0" + "\2\7\1\0\1\u0154\12\0\34\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\6\7\1\u012e\25\7\6\0\2\7\1\0" + "\1\7\12\0\11\7\1\u0155\22\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\25\7\1\143\2\7\1\143\3\7\6\0" + "\2\7\1\0\1\7\12\0\27\7\1\u0156\4\7\6\0"
|
||||
+ "\2\7\1\0\1\7\12\0\1\u0157\33\7\6\0\2\7" + "\1\0\1\7\12\0\6\7\1\213\25\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\1\u0158\33\7\6\0\2\7\1\0" + "\1\7\12\0\5\7\1\u012c\26\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\213\33\7\6\0\2\7\1\0\1\7" + "\12\0\1\u0100\33\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\10\7\1\223\23\7\6\0\2\7\1\0\1\7\12\0" + "\27\7\1\213\4\7\6\0\2\7\1\0\1\7\12\0"
|
||||
+ "\2\7\1\u012e\1\7\1\u0159\5\7\1\u0152\21\7\6\0" + "\2\7\1\0\1\7\12\0\1\u015a\33\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\4\7\1\u015b\27\7\6\0\2\7" + "\1\0\1\7\12\0\5\7\1\u0100\26\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\15\7\1\370\16\7\6\0\2\7" + "\1\0\1\7\12\0\14\7\1\u015c\17\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\10\7\1\u0100\23\7\6\0\2\7" + "\1\0\1\7\12\0\21\7\1\213\12\7\6\0\2\7"
|
||||
+ "\1\0\1\7\12\0\15\7\1\u015d\16\7\6\0\2\7" + "\1\0\1\7\12\0\1\u015e\33\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\10\7\1\u015f\23\7\6\0\2\7\1\0" + "\1\7\12\0\4\7\1\u0160\27\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\1\7\1\u0161\32\7\6\0\2\7\1\0" + "\1\7\12\0\15\7\1\u0162\16\7\6\0\2\7\1\0"
|
||||
+ "\1\7\12\0\22\7\1\213\11\7\4\0";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[15936];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\4\0\2\11\4\1\1\11\3\1\1\11\31\1\2\11"
|
||||
+ "\2\1\1\11\2\1\1\11\2\1\1\11\1\1\1\0" + "\1\1\1\11\113\1\3\11\1\1\1\0\333\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[354];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public SQLTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden to return <code>true</code> so paren matching occurs for SQL.
|
||||
*
|
||||
* @return <code>true</code> always.
|
||||
*/
|
||||
@Override
|
||||
public boolean getCurlyBracesDenoteCodeBlocks(int languageIndex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "--", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = STRING;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.LITERAL_CHAR:
|
||||
state = CHAR;
|
||||
start = text.offset;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
start = text.offset;
|
||||
break;
|
||||
default:
|
||||
state = Token.NULL;
|
||||
}
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public SQLTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public SQLTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 178) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 20: {
|
||||
addToken(Token.PREPROCESSOR);
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 2: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 21: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 18: {
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(MLC);
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 9: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(CHAR);
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.LITERAL_NUMBER_FLOAT);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 19: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
case 15: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead, Token.LITERAL_CHAR);
|
||||
}
|
||||
case 33:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 34:
|
||||
break;
|
||||
case 22: {
|
||||
addToken(Token.FUNCTION);
|
||||
}
|
||||
case 35:
|
||||
break;
|
||||
case 12: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 36:
|
||||
break;
|
||||
case 17: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
}
|
||||
case 37:
|
||||
break;
|
||||
case 8: {
|
||||
start = zzMarkedPos - 1;
|
||||
yybegin(STRING);
|
||||
}
|
||||
case 38:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||
}
|
||||
case 39:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 40:
|
||||
break;
|
||||
case 13: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 41:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(Token.ERROR_IDENTIFIER);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 42:
|
||||
break;
|
||||
case 11: {
|
||||
}
|
||||
case 43:
|
||||
break;
|
||||
case 16: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
return firstToken;
|
||||
}
|
||||
case 44:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case STRING: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 355:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 356:
|
||||
break;
|
||||
case MLC: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
return firstToken;
|
||||
}
|
||||
case 357:
|
||||
break;
|
||||
case CHAR: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
|
||||
return firstToken;
|
||||
}
|
||||
case 358:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,383 +0,0 @@
|
||||
/*
|
||||
* 8/19/2009
|
||||
*
|
||||
* ScalaTokenMaker.java - Scanner for the Scala programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Scala programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>ScalaTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class ScalaTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public ScalaTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = MULTILINE_STRING_DOUBLE;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
break;
|
||||
default:
|
||||
state = YYINITIAL;
|
||||
}
|
||||
|
||||
s = text;
|
||||
start = text.offset;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
|
||||
/***** BEGIN SCALA-SPECIFIC CHANGES *********/
|
||||
Upper = ([A-Z\$\_]) /* Plus Unicode category Lu */
|
||||
Lower = ([a-z]) /* Plus Unicode category Ll */
|
||||
Letter = ({Upper}|{Lower}) /*Plus Unicode categories Lo, Lt, Nl */
|
||||
Digit = ([0-9])
|
||||
OpChar = ([^A-Z\$\_a-z0-9\(\[\]\)\. \t\f])
|
||||
Op = ({OpChar}+)
|
||||
IdRest = (({Letter}|{Digit})*([\_]{Op})?)
|
||||
VarId = ({Lower}{IdRest})
|
||||
PlainId = ({Upper}{IdRest}|{VarId}) /*|{Op})*/
|
||||
Id = ({PlainId}) /*({PlainId}|[\']{StringLit}[\'])*/
|
||||
|
||||
IntegerLiteral = ({Digit}+[Ll]?)
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
HexLiteral = ("0x"{HexDigit}+)
|
||||
|
||||
ExponentPart = ([Ee][+\-]?{Digit}+)
|
||||
FloatType = ([FfDd])
|
||||
FloatingPointLiteral = ({Digit}+[\.]{Digit}*{ExponentPart}?{FloatType}? |
|
||||
[\.]{Digit}+{ExponentPart}?{FloatType}? |
|
||||
{Digit}+{ExponentPart}{FloatType}? |
|
||||
{Digit}+{ExponentPart}?{FloatType})
|
||||
|
||||
UnclosedCharLiteral = ([\']([\\].|[^\\\'])*[^\']?)
|
||||
CharLiteral = ({UnclosedCharLiteral}[\'])
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
StringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
UnclosedBacktickLiteral = ([\`][^\`]+)
|
||||
BacktickLiteral = ({UnclosedBacktickLiteral}[\`])
|
||||
/* TODO: Multiline strings */
|
||||
|
||||
MLCBegin = ("/*")
|
||||
MLCEnd = ("*/")
|
||||
LineCommentBegin = ("//")
|
||||
|
||||
/***** END SCALA-SPECIFIC CHANGES *********/
|
||||
|
||||
Whitespace = ([ \t\f]+)
|
||||
LineTerminator = ([\n])
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({Letter}|[\_]|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state MULTILINE_STRING_DOUBLE
|
||||
%state MLC
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"abstract" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"def" |
|
||||
"do" |
|
||||
"else" |
|
||||
"extends" |
|
||||
"false" |
|
||||
"final" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"forSome" |
|
||||
"if" |
|
||||
"implicit" |
|
||||
"import" |
|
||||
"lazy" |
|
||||
"match" |
|
||||
"new" |
|
||||
"null" |
|
||||
"object" |
|
||||
"override" |
|
||||
"package" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"requires" |
|
||||
"return" |
|
||||
"sealed" |
|
||||
"super" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"trait" |
|
||||
"try" |
|
||||
"true" |
|
||||
"type" |
|
||||
"val" |
|
||||
"var" |
|
||||
"while" |
|
||||
"with" |
|
||||
"yield" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Id} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
\"\"\" { start = zzMarkedPos-3; yybegin(MULTILINE_STRING_DOUBLE); }
|
||||
{UnclosedCharLiteral} { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
{CharLiteral} { addToken(Token.LITERAL_CHAR); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedBacktickLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
{BacktickLiteral} { addToken(Token.LITERAL_BACKQUOTE); }
|
||||
|
||||
/* Comment literals. */
|
||||
{MLCBegin} { start = zzMarkedPos-2; yybegin(MLC); }
|
||||
{LineCommentBegin} { start = zzMarkedPos-2; yybegin(EOL_COMMENT); }
|
||||
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatingPointLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<MULTILINE_STRING_DOUBLE> {
|
||||
[^\"\\\n]* {}
|
||||
\\.? { /* Skip escaped chars, handles case: '\"""'. */ }
|
||||
\"\"\" { addToken(start,zzStartRead+2, Token.LITERAL_STRING_DOUBLE_QUOTE); yybegin(YYINITIAL); }
|
||||
\" {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken; }
|
||||
}
|
||||
|
||||
<MLC> {
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
{MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken; }
|
||||
}
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
@@ -1,866 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 11/10/12 10:31 PM */
|
||||
/*
|
||||
* 8/19/2009
|
||||
* ScalaTokenMaker.java - Scanner for the Scala programming language.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexCTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for the Scala programming language.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>ScalaTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class ScalaTokenMaker extends AbstractJFlexCTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int EOL_COMMENT = 3;
|
||||
public static final int MULTILINE_STRING_DOUBLE = 1;
|
||||
public static final int YYINITIAL = 0;
|
||||
public static final int MLC = 2;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\31\1\24\1\0\1\31\23\0\1\31\1\33\1\25\1\33"
|
||||
+ "\1\1\1\33\1\33\1\22\2\4\1\30\1\16\1\33\1\16\1\21" + "\1\27\1\12\11\3\1\42\1\33\1\0\1\33\1\0\2\33\3\10"
|
||||
+ "\1\17\1\14\1\17\5\1\1\6\6\1\1\52\7\1\1\4\1\23" + "\1\4\1\0\1\5\1\26\1\44\1\45\1\11\1\20\1\15\1\40"
|
||||
+ "\1\61\1\34\1\41\1\56\1\60\1\7\1\53\1\50\1\47\1\36" + "\1\2\1\46\1\37\1\35\1\55\1\57\1\43\1\13\1\51\1\54"
|
||||
+ "\1\32\1\0\1\32\1\33\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\1\0\1\1\2\0\2\2\1\3\1\4\2\2\1\3"
|
||||
+ "\3\2\1\5\1\6\1\7\2\2\1\10\15\2\1\1" + "\1\11\1\12\2\1\1\13\5\1\1\14\3\1\1\2"
|
||||
+ "\1\3\1\0\2\15\3\2\1\0\3\2\1\16\1\17" + "\1\5\2\7\1\20\1\7\1\21\1\22\26\2\1\11"
|
||||
+ "\1\0\1\23\10\0\1\2\1\15\1\0\4\2\1\24" + "\1\2\1\20\1\25\1\26\11\2\1\16\12\2\1\27"
|
||||
+ "\10\0\21\2\2\0\1\30\2\0\1\31\4\2\1\16" + "\6\2\4\0\3\2";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[184];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\62\0\144\0\226\0\310\0\372\0\u012c\0\310"
|
||||
+ "\0\u015e\0\u0190\0\u01c2\0\u01f4\0\u0226\0\u0258\0\u028a\0\310"
|
||||
+ "\0\u02bc\0\u02ee\0\u0320\0\u0352\0\u0384\0\u03b6\0\u03e8\0\u041a"
|
||||
+ "\0\u044c\0\u047e\0\u04b0\0\u04e2\0\u0514\0\u0546\0\u0578\0\u05aa"
|
||||
+ "\0\u05dc\0\u060e\0\u0640\0\310\0\u0672\0\u06a4\0\310\0\u06d6"
|
||||
+ "\0\u0708\0\u073a\0\u076c\0\u079e\0\310\0\u07d0\0\u0802\0\u0834"
|
||||
+ "\0\u0866\0\310\0\u0898\0\310\0\u08ca\0\u08fc\0\u092e\0\u0960"
|
||||
+ "\0\u0992\0\u09c4\0\u09f6\0\u0a28\0\372\0\310\0\u0a5a\0\u0a8c"
|
||||
+ "\0\u0abe\0\u0af0\0\u0b22\0\310\0\310\0\u0b54\0\u0b86\0\u0bb8"
|
||||
+ "\0\u0bea\0\u0c1c\0\u0c4e\0\u0c80\0\u0cb2\0\u0ce4\0\u0d16\0\u0d48"
|
||||
+ "\0\u0d7a\0\u0dac\0\u0dde\0\u0e10\0\u0e42\0\u0e74\0\u0ea6\0\u0ed8"
|
||||
+ "\0\u0f0a\0\u0f3c\0\u0f6e\0\310\0\u0fa0\0\310\0\u0fd2\0\u1004"
|
||||
+ "\0\u1036\0\u1068\0\u109a\0\u10cc\0\u10fe\0\u1130\0\u1162\0\u1194"
|
||||
+ "\0\u11c6\0\u11f8\0\u122a\0\u125c\0\u128e\0\u0992\0\u12c0\0\310"
|
||||
+ "\0\310\0\310\0\u12f2\0\u1324\0\u1356\0\u1388\0\u13ba\0\u13ec"
|
||||
+ "\0\u141e\0\u1450\0\u1482\0\u14b4\0\u14e6\0\u1518\0\u154a\0\u157c"
|
||||
+ "\0\u15ae\0\u15e0\0\u1612\0\u1644\0\u1676\0\u16a8\0\310\0\u16da"
|
||||
+ "\0\u170c\0\u173e\0\u1770\0\u17a2\0\u17d4\0\u1806\0\u1838\0\u186a"
|
||||
+ "\0\u189c\0\u18ce\0\u1900\0\u1932\0\u1964\0\u1996\0\u19c8\0\u19fa"
|
||||
+ "\0\u1a2c\0\u1a5e\0\u1a90\0\u1ac2\0\u1af4\0\u1b26\0\u1b58\0\u1b8a"
|
||||
+ "\0\u1bbc\0\u1bee\0\u1c20\0\u1c52\0\u1c84\0\u1cb6\0\u1ce8\0\u1d1a"
|
||||
+ "\0\u1d4c\0\u1d7e\0\u1db0\0\u1de2\0\u1e14\0\u1e46\0\u1e78\0\u1eaa"
|
||||
+ "\0\u1edc\0\u1f0e\0\u1c20\0\u1f40\0\u1cb6\0\u1f72\0\u1fa4\0\u1fd6";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[184];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\5\2\6\1\7\1\10\2\6\1\11\1\6\1\12"
|
||||
+ "\1\13\2\6\1\14\1\5\1\6\1\15\1\16\1\17" + "\1\5\1\20\1\21\1\22\1\23\1\5\1\24\1\10"
|
||||
+ "\1\5\1\6\1\25\1\26\1\27\1\30\1\31\1\5" + "\1\32\1\33\1\6\1\34\1\35\1\36\1\37\1\6"
|
||||
+ "\1\40\3\6\1\41\2\6\23\42\1\43\1\44\1\45" + "\34\42\24\46\1\47\3\46\1\50\3\46\1\51\3\46"
|
||||
+ "\1\52\2\46\1\53\16\46\24\54\1\55\7\54\1\56" + "\3\54\1\57\2\54\1\60\16\54\63\0\3\6\1\0"
|
||||
+ "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\17\6" + "\3\0\1\7\2\0\2\62\2\0\1\7\1\0\2\63"
|
||||
+ "\1\0\2\64\1\65\16\0\1\64\22\0\3\6\1\0" + "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\1\6"
|
||||
+ "\1\66\15\6\1\0\3\6\1\0\1\61\1\6\1\67" + "\6\6\1\0\2\6\13\0\6\6\1\0\1\6\1\70"
|
||||
+ "\15\6\3\0\1\7\2\0\2\62\2\0\1\7\1\71" + "\2\63\1\0\2\64\1\65\16\0\1\64\22\0\3\6"
|
||||
+ "\1\0\1\61\1\6\1\72\3\6\1\73\2\6\1\0" + "\2\6\13\0\6\6\1\0\17\6\1\0\3\6\1\0"
|
||||
+ "\1\61\7\6\1\74\1\0\2\6\13\0\6\6\1\0" + "\4\6\1\75\12\6\3\0\1\65\6\0\1\65\47\0"
|
||||
+ "\22\17\1\76\1\77\36\17\23\100\1\101\1\100\1\102" + "\34\100\26\103\1\0\33\103\27\0\1\104\1\105\62\0"
|
||||
+ "\1\24\31\0\3\6\1\0\1\61\10\6\1\0\2\6" + "\13\0\1\106\5\6\1\0\3\6\1\107\2\6\1\110"
|
||||
+ "\10\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6" + "\13\0\6\6\1\0\1\6\1\111\1\6\1\112\13\6"
|
||||
+ "\1\0\3\6\1\0\1\61\7\6\1\113\1\0\2\6" + "\13\0\6\6\1\0\12\6\1\114\4\6\1\0\3\6"
|
||||
+ "\1\0\1\61\10\6\1\0\2\6\13\0\5\6\1\115" + "\1\0\1\6\1\116\2\6\1\117\12\6\1\0\3\6"
|
||||
+ "\1\0\1\61\10\6\1\0\2\6\13\0\4\6\1\75" + "\1\6\1\0\10\6\1\120\6\6\1\0\3\6\1\0"
|
||||
+ "\1\61\10\6\1\0\2\6\13\0\1\121\4\6\1\122" + "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\2\6\13\0\6\6\1\0\2\6\1\123\14\6\1\0" + "\3\6\1\0\1\61\7\6\1\124\1\0\2\6\13\0"
|
||||
+ "\6\6\1\0\17\6\1\0\3\6\1\0\1\61\10\6" + "\1\0\2\6\13\0\6\6\1\0\2\6\1\125\11\6"
|
||||
+ "\1\126\2\6\1\0\3\6\1\0\1\61\7\6\1\127" + "\1\0\2\6\13\0\6\6\1\0\12\6\1\130\4\6"
|
||||
+ "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0" + "\5\6\1\131\1\0\17\6\1\0\3\6\1\0\1\61"
|
||||
+ "\10\6\1\0\2\6\13\0\6\6\1\0\1\6\1\132" + "\15\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6"
|
||||
+ "\13\0\6\6\1\0\1\6\1\133\15\6\23\42\3\0" + "\34\42\24\134\1\0\35\134\25\0\1\135\34\0\24\46"
|
||||
+ "\1\0\3\46\1\0\3\46\1\0\3\46\1\0\2\46" + "\1\0\16\46\27\0\1\136\67\0\1\137\61\0\1\140"
|
||||
+ "\3\0\1\141\63\0\1\142\16\0\24\54\1\0\7\54" + "\1\0\3\54\1\0\2\54\1\0\16\54\35\0\1\143"
|
||||
+ "\61\0\1\144\3\0\1\145\63\0\1\146\16\0\1\147" + "\3\6\1\0\1\61\10\6\1\147\2\6\1\0\7\147"
|
||||
+ "\1\0\2\147\6\6\1\147\17\6\3\0\1\150\6\0" + "\1\150\3\0\1\151\46\0\1\65\6\0\1\65\1\0"
|
||||
+ "\2\63\1\0\2\64\17\0\1\64\22\0\3\6\1\0" + "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\11\6"
|
||||
+ "\1\152\5\6\1\0\3\6\1\0\1\61\10\6\1\0" + "\2\6\13\0\6\6\1\0\1\6\1\153\15\6\1\0"
|
||||
+ "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\1\6" + "\1\154\1\6\1\155\2\6\1\0\17\6\3\0\1\156"
|
||||
+ "\4\0\3\156\1\0\2\156\1\0\2\156\17\0\1\156" + "\3\0\2\156\15\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\2\6\13\0\3\6\1\155\2\6\1\0\17\6\1\0" + "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\1\6"
|
||||
+ "\1\157\4\6\1\0\17\6\1\0\3\6\1\0\1\61" + "\10\6\1\0\2\6\13\0\4\6\1\75\1\6\1\0"
|
||||
+ "\17\6\24\17\1\0\35\17\23\100\1\101\1\100\1\160" + "\60\100\1\0\35\100\25\0\1\161\34\0\26\103\1\162"
|
||||
+ "\33\103\1\0\3\6\1\0\1\61\10\6\1\0\2\6" + "\13\0\5\6\1\163\1\0\3\6\1\164\13\6\1\0"
|
||||
+ "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\6\6" + "\1\0\1\6\1\165\4\6\1\75\3\6\1\155\4\6"
|
||||
+ "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0" + "\2\6\1\155\3\6\1\0\17\6\1\0\3\6\1\0"
|
||||
+ "\1\61\3\6\1\166\4\6\1\0\2\6\13\0\6\6" + "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\2\6\13\0\5\6\1\167\1\0\4\6\1\170\12\6" + "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0"
|
||||
+ "\6\6\1\0\1\6\1\171\15\6\1\0\3\6\1\0" + "\1\61\10\6\1\0\2\6\13\0\2\6\1\172\3\6"
|
||||
+ "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0" + "\2\6\13\0\6\6\1\0\5\6\1\173\11\6\1\0"
|
||||
+ "\3\6\1\0\1\61\1\6\1\72\6\6\1\0\2\6" + "\13\0\6\6\1\0\17\6\1\0\3\6\1\0\1\61"
|
||||
+ "\10\6\1\0\2\6\13\0\6\6\1\0\3\6\1\174" + "\13\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6"
|
||||
+ "\13\0\2\6\1\175\3\6\1\0\17\6\1\0\3\6" + "\1\0\1\61\10\6\1\0\2\6\13\0\5\6\1\176"
|
||||
+ "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0" + "\2\6\13\0\1\6\1\177\4\6\1\0\17\6\1\0"
|
||||
+ "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\3\6" + "\1\200\2\6\1\0\17\6\1\0\1\6\1\201\1\6"
|
||||
+ "\1\0\1\61\10\6\1\0\2\6\13\0\1\6\1\202" + "\4\6\1\0\17\6\1\0\3\6\1\0\1\61\10\6"
|
||||
+ "\1\0\2\6\13\0\6\6\1\0\13\6\1\203\3\6" + "\1\0\3\6\1\0\1\61\7\6\1\204\1\0\2\6"
|
||||
+ "\13\0\6\6\1\0\17\6\1\0\3\6\1\0\1\61" + "\10\6\1\0\2\6\13\0\6\6\1\0\1\75\16\6"
|
||||
+ "\1\0\3\6\1\0\1\61\1\6\1\205\6\6\1\0" + "\2\6\13\0\6\6\1\0\17\6\1\0\3\6\1\0"
|
||||
+ "\1\61\7\6\1\206\1\0\2\6\13\0\6\6\1\0" + "\17\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6"
|
||||
+ "\13\0\1\6\1\154\4\6\1\0\17\6\1\0\3\6" + "\1\0\1\61\1\6\1\75\6\6\1\0\2\6\13\0"
|
||||
+ "\6\6\1\0\3\6\1\75\13\6\25\0\1\207\71\0" + "\1\210\62\0\1\211\32\0\1\212\115\0\1\213\53\0"
|
||||
+ "\1\214\62\0\1\215\32\0\1\216\115\0\1\217\16\0" + "\1\147\15\0\1\147\3\0\7\147\1\0\2\147\6\0"
|
||||
+ "\1\147\22\0\1\150\6\0\1\150\4\0\2\64\17\0" + "\1\64\24\0\1\150\6\0\1\150\50\0\3\6\1\0"
|
||||
+ "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\6\6" + "\1\75\10\6\1\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\2\6\13\0\3\6\1\163\2\6\1\0\17\6\1\0" + "\3\6\1\0\1\61\3\6\1\177\4\6\1\0\2\6"
|
||||
+ "\13\0\6\6\1\0\17\6\1\0\3\6\1\0\1\61" + "\7\6\1\75\1\0\2\6\13\0\6\6\1\0\17\6"
|
||||
+ "\1\0\3\6\1\0\1\61\7\6\1\220\1\0\2\6" + "\13\0\6\6\1\0\17\6\1\0\3\6\1\0\1\61"
|
||||
+ "\10\6\1\0\2\6\13\0\3\6\1\75\2\6\1\0" + "\17\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6"
|
||||
+ "\13\0\6\6\1\0\4\6\1\127\12\6\1\0\3\6" + "\1\0\1\61\10\6\1\0\2\6\13\0\5\6\1\221"
|
||||
+ "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0" + "\2\6\13\0\6\6\1\0\15\6\1\222\1\6\1\0"
|
||||
+ "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\6\6" + "\1\0\14\6\1\223\2\6\1\0\3\6\1\0\1\61"
|
||||
+ "\10\6\1\0\2\6\13\0\1\6\1\224\4\6\1\0" + "\17\6\1\0\3\6\1\0\1\61\1\6\1\225\6\6"
|
||||
+ "\1\0\2\6\13\0\6\6\1\0\17\6\1\0\3\6" + "\1\0\1\61\7\6\1\226\1\0\2\6\13\0\6\6"
|
||||
+ "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0" + "\2\6\13\0\6\6\1\0\1\6\1\227\15\6\1\0"
|
||||
+ "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\6\6" + "\1\0\7\6\1\230\7\6\1\0\3\6\1\0\1\61"
|
||||
+ "\1\6\1\231\6\6\1\0\2\6\13\0\6\6\1\0" + "\4\6\1\232\12\6\1\0\3\6\1\0\1\61\1\6"
|
||||
+ "\1\155\6\6\1\0\2\6\13\0\6\6\1\0\17\6" + "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0"
|
||||
+ "\1\75\5\6\1\0\17\6\1\0\3\6\1\0\1\61" + "\10\6\1\0\2\6\13\0\1\6\1\233\4\6\1\0"
|
||||
+ "\17\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6" + "\13\0\6\6\1\0\12\6\1\234\4\6\1\0\3\6"
|
||||
+ "\1\0\1\61\10\6\1\0\2\6\13\0\6\6\1\0" + "\12\6\1\235\4\6\1\0\3\6\1\0\1\61\7\6"
|
||||
+ "\1\236\1\0\2\6\13\0\6\6\1\0\17\6\1\0" + "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\6\6"
|
||||
+ "\1\0\3\6\1\237\13\6\1\0\3\6\1\0\1\61" + "\1\6\1\75\6\6\1\0\2\6\13\0\6\6\1\0"
|
||||
+ "\17\6\1\0\3\6\1\0\1\61\1\6\1\240\6\6" + "\1\0\2\6\13\0\6\6\1\0\17\6\36\0\1\241"
|
||||
+ "\65\0\1\242\34\0\1\211\65\0\1\243\76\0\1\244" + "\65\0\1\245\34\0\1\215\65\0\1\246\41\0\3\6"
|
||||
+ "\1\0\1\61\10\6\1\0\2\6\13\0\6\6\1\0" + "\5\6\1\247\11\6\1\0\3\6\1\0\1\61\10\6"
|
||||
+ "\1\0\2\6\13\0\1\6\1\75\4\6\1\0\17\6" + "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0"
|
||||
+ "\6\6\1\0\1\6\1\250\15\6\1\0\3\6\1\0" + "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\1\6"
|
||||
+ "\1\251\15\6\1\0\3\6\1\0\1\61\7\6\1\252" + "\1\0\2\6\13\0\6\6\1\0\17\6\1\0\3\6"
|
||||
+ "\1\0\1\61\7\6\1\240\1\0\2\6\13\0\6\6" + "\1\0\17\6\1\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\2\6\13\0\6\6\1\0\3\6\1\75\13\6\1\0" + "\3\6\1\0\1\61\1\6\1\253\6\6\1\0\2\6"
|
||||
+ "\13\0\6\6\1\0\17\6\1\0\3\6\1\0\1\61" + "\10\6\1\0\2\6\13\0\6\6\1\0\4\6\1\254"
|
||||
+ "\12\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6" + "\13\0\5\6\1\255\1\0\17\6\1\0\3\6\1\0"
|
||||
+ "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\3\6" + "\1\221\13\6\1\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\2\6\13\0\6\6\1\0\3\6\1\256\13\6\1\0" + "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\5\6"
|
||||
+ "\1\257\1\0\17\6\1\0\3\6\1\0\1\61\10\6" + "\1\0\2\6\13\0\6\6\1\0\3\6\1\260\13\6"
|
||||
+ "\1\0\3\6\1\0\1\61\3\6\1\221\4\6\1\0" + "\2\6\13\0\6\6\1\0\17\6\1\0\3\6\1\0"
|
||||
+ "\1\61\10\6\1\0\2\6\13\0\6\6\1\0\3\6" + "\1\261\13\6\1\0\3\6\1\0\1\61\10\6\1\0"
|
||||
+ "\1\6\1\75\13\0\6\6\1\0\17\6\37\0\1\211" + "\2\0\1\242\46\0\1\262\33\0\3\243\1\263\11\243"
|
||||
+ "\1\263\2\243\2\263\4\0\1\243\1\263\2\0\1\263" + "\6\243\1\263\17\243\37\0\1\215\2\0\1\245\46\0"
|
||||
+ "\1\264\33\0\3\246\1\265\11\246\1\265\2\246\2\265" + "\4\0\1\246\1\265\2\0\1\265\6\246\1\265\17\246"
|
||||
+ "\1\0\3\6\1\0\1\61\10\6\1\0\1\6\1\163" + "\13\0\6\6\1\0\17\6\1\0\3\6\1\0\1\61"
|
||||
+ "\10\6\1\0\2\6\13\0\6\6\1\0\16\6\1\155" + "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0"
|
||||
+ "\1\6\1\155\4\6\1\0\17\6\1\0\3\6\1\0" + "\1\61\3\6\1\266\4\6\1\0\2\6\13\0\6\6"
|
||||
+ "\1\0\17\6\1\0\3\6\1\0\1\61\1\6\1\152" + "\6\6\1\0\2\6\13\0\6\6\1\0\17\6\1\0"
|
||||
+ "\3\6\1\0\1\61\10\6\1\0\2\6\13\0\6\6" + "\1\0\10\6\1\155\6\6\1\0\3\6\1\0\1\61"
|
||||
+ "\3\6\1\165\4\6\1\0\2\6\13\0\6\6\1\0" + "\17\6\1\0\3\6\1\0\1\61\10\6\1\0\2\6"
|
||||
+ "\13\0\6\6\1\0\1\6\1\236\15\6\1\0\3\6" + "\1\0\1\61\10\6\1\0\2\6\13\0\6\6\1\0"
|
||||
+ "\3\6\1\267\13\6\1\0\3\6\1\0\1\61\10\6" + "\1\0\2\6\13\0\6\6\1\0\5\6\1\75\11\6"
|
||||
+ "\1\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0" + "\5\6\1\270\1\0\17\6\27\0\1\243\61\0\1\246"
|
||||
+ "\33\0\3\6\1\0\1\61\10\6\1\0\2\6\13\0" + "\1\6\1\225\4\6\1\0\17\6\1\0\3\6\1\0"
|
||||
+ "\1\61\7\6\1\163\1\0\2\6\13\0\6\6\1\0" + "\17\6\1\0\3\6\1\0\1\61\10\6\1\0\1\6"
|
||||
+ "\1\155\13\0\6\6\1\0\17\6";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[8200];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\1\1\2\0\1\11\2\1\1\11\7\1\1\11"
|
||||
+ "\23\1\1\11\2\1\1\11\5\1\1\11\4\1\1\11" + "\1\0\1\11\4\1\1\0\4\1\1\11\5\1\2\11"
|
||||
+ "\26\1\1\11\1\0\1\11\10\0\2\1\1\0\6\1" + "\3\11\24\1\1\11\10\0\21\1\2\0\1\1\2\0" + "\14\1\4\0\3\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[184];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public ScalaTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start, end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
||||
state = MULTILINE_STRING_DOUBLE;
|
||||
break;
|
||||
case Token.COMMENT_MULTILINE:
|
||||
state = MLC;
|
||||
break;
|
||||
default:
|
||||
state = YYINITIAL;
|
||||
}
|
||||
s = text;
|
||||
start = text.offset;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public ScalaTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public ScalaTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 150) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 6: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 15: {
|
||||
addToken(Token.LITERAL_CHAR);
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 21: {
|
||||
start = zzMarkedPos - 3;
|
||||
yybegin(MULTILINE_STRING_DOUBLE);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
case 19: {
|
||||
yybegin(YYINITIAL);
|
||||
addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
|
||||
}
|
||||
case 29:
|
||||
break;
|
||||
case 18: {
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(MLC);
|
||||
}
|
||||
case 30:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 31:
|
||||
break;
|
||||
case 20: {
|
||||
addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
|
||||
}
|
||||
case 32:
|
||||
break;
|
||||
case 13: {
|
||||
addToken(Token.LITERAL_NUMBER_FLOAT);
|
||||
}
|
||||
case 33:
|
||||
break;
|
||||
case 14: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 34:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 35:
|
||||
break;
|
||||
case 22: {
|
||||
addToken(Token.LITERAL_BACKQUOTE);
|
||||
}
|
||||
case 36:
|
||||
break;
|
||||
case 9: { /* Skip escaped chars, handles case: '\"""'. */
|
||||
}
|
||||
case 37:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 38:
|
||||
break;
|
||||
case 12: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 39:
|
||||
break;
|
||||
case 17: {
|
||||
start = zzMarkedPos - 2;
|
||||
yybegin(EOL_COMMENT);
|
||||
}
|
||||
case 40:
|
||||
break;
|
||||
case 23: {
|
||||
addToken(start, zzStartRead + 2, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
yybegin(YYINITIAL);
|
||||
}
|
||||
case 41:
|
||||
break;
|
||||
case 5: {
|
||||
addToken(Token.ERROR_CHAR);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 42:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.ERROR_STRING_DOUBLE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 43:
|
||||
break;
|
||||
case 16: {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 44:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 45:
|
||||
break;
|
||||
case 25: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 46:
|
||||
break;
|
||||
case 24: {
|
||||
int temp = zzStartRead;
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
|
||||
start = zzMarkedPos;
|
||||
}
|
||||
case 47:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||
}
|
||||
case 48:
|
||||
break;
|
||||
case 1: {
|
||||
}
|
||||
case 49:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
return firstToken;
|
||||
}
|
||||
case 50:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case EOL_COMMENT: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 185:
|
||||
break;
|
||||
case MULTILINE_STRING_DOUBLE: {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
return firstToken;
|
||||
}
|
||||
case 186:
|
||||
break;
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 187:
|
||||
break;
|
||||
case MLC: {
|
||||
addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
|
||||
return firstToken;
|
||||
}
|
||||
case 188:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,401 +0,0 @@
|
||||
/*
|
||||
* 10/03/2007
|
||||
*
|
||||
* TclTokenMaker.java - Scanner for the Tcl programming language.
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for the Tcl programming language.<p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>TclTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class TclTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public TclTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({Letter}|"_"|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
|
||||
StringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
LineCommentBegin = "#"
|
||||
|
||||
IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
IntegerLiteral = ({IntegerHelper1}[lL]?)
|
||||
HexLiteral = ({IntegerHelper2}[lL]?)
|
||||
FloatHelper1 = ([fFdD]?)
|
||||
FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
|
||||
FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
|
||||
FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
|
||||
FloatLiteral3 = ({Digit}+{FloatHelper2})
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
|
||||
Separator = ([\(\)\{\}\[\]])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
Operator = ("="|"!"|"+"|"-"|"*"|"/"|">"=?|"<"=?|"%"|"&"|"|"|"^"|"~")
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
|
||||
%%
|
||||
|
||||
/* Keywords */
|
||||
<YYINITIAL> "append" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "array" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "auto_mkindex" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "concat" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "console" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "eval" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "expr" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "format" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "global" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "set" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "trace" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "unset" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "upvar" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "join" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lappend" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lindex" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "linsert" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "list" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "llength" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lrange" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lreplace" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lsearch" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lsort" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "split" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "scan" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "string" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "regexp" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "regsub" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "if" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "else" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "elseif" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "switch" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "for" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "foreach" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "while" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "break" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "continue" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "proc" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "return" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "source" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "unkown" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "uplevel" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "cd" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "close" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "eof" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "file" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "flush" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "gets" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "glob" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "open" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "read" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "puts" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "pwd" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "seek" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "tell" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "catch" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "error" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "exec" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "pid" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "after" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "time" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "exit" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "history" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "rename" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "info" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "ceil" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "floor" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "round" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "incr" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "hypot" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "abs" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "acos" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "cos" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "cosh" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "asin" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "sin" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "sinh" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "atan" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "atan2" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "tan" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "tanh" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "log" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "log10" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "fmod" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "pow" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "hypot" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "sqrt" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "double" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "int" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
<YYINITIAL> "bind" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "button" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "canvas" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "checkbutton" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "destroy" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "entry" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "focus" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "frame" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "grab" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "image" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "label" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "listbox" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "lower" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "menu" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "menubutton" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "message" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "option" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "pack" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "placer" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "radiobutton" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "raise" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "scale" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "scrollbar" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "selection" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "send" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "text" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "tk" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "tkerror" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "tkwait" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "toplevel" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "update" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "winfo" { addToken(Token.RESERVED_WORD); }
|
||||
<YYINITIAL> "wm" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
|
||||
/* Comment literals. */
|
||||
{LineCommentBegin}.* { addToken(Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
|
||||
/* Separators. */
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
@@ -1,837 +0,0 @@
|
||||
/* The following code was generated by JFlex 1.4.1 on 10/10/10 10:56 PM */
|
||||
/*
|
||||
* 10/03/2007
|
||||
* TclTokenMaker.java - Scanner for the Tcl programming language.
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractJFlexCTokenMaker;
|
||||
import org.fife.ui.rsyntaxtextarea.Token;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenImpl;
|
||||
|
||||
/**
|
||||
* Scanner for the Tcl programming language.
|
||||
* <p>
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost completely
|
||||
* removed to be competitive with the handwritten lexers (subclasses of
|
||||
* <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around). We can
|
||||
* achieve this because RText always scans exactly 1 line of tokens at a time,
|
||||
* and hands the scanner this line as an array of characters (a Segment really).
|
||||
* Since tokens contain pointers to char arrays instead of Strings holding their
|
||||
* contents, there is no need for allocating new memory for Strings.
|
||||
* <p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.
|
||||
* <p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>TclTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>. You
|
||||
* should hand-delete the second of each definition (the ones generated by the
|
||||
* lexer), as these generated methods modify the input buffer, which we'll never
|
||||
* have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT be
|
||||
* initialized. This is a needless memory allocation for us since we will be
|
||||
* pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would with
|
||||
* any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.5
|
||||
*
|
||||
*/
|
||||
public class TclTokenMaker extends AbstractJFlexCTokenMaker {
|
||||
|
||||
/** This character denotes the end of file */
|
||||
public static final int YYEOF = -1;
|
||||
/** lexical states */
|
||||
public static final int YYINITIAL = 0;
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final String ZZ_CMAP_PACKED = "\11\0\1\14\1\13\1\0\1\14\1\7\22\0\1\14\1\27\1\15"
|
||||
+ "\1\10\1\1\1\27\1\27\1\7\2\24\1\27\1\22\1\25\1\22" + "\1\23\1\27\1\3\1\61\1\60\5\5\2\2\1\7\1\25\1\30"
|
||||
+ "\1\26\1\30\1\7\1\0\3\4\1\20\1\21\1\20\5\1\1\17" + "\13\1\1\16\2\1\1\24\1\11\1\24\1\27\1\12\1\0\1\31"
|
||||
+ "\1\54\1\46\1\35\1\33\1\52\1\53\1\56\1\44\1\55\1\43" + "\1\50\1\42\1\34\1\41\1\32\1\62\1\36\1\47\1\40\1\6"
|
||||
+ "\1\51\1\57\1\45\1\37\1\1\1\24\1\27\1\24\1\27\uff81\0";
|
||||
/**
|
||||
* Translates characters to character classes
|
||||
*/
|
||||
private static final char[] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
||||
/**
|
||||
* Translates DFA states to action switch labels.
|
||||
*/
|
||||
private static final int[] ZZ_ACTION = zzUnpackAction();
|
||||
private static final String ZZ_ACTION_PACKED_0 = "\1\0\1\1\1\2\2\3\1\2\1\1\1\4\1\5"
|
||||
+ "\1\6\1\7\1\10\1\2\1\11\1\2\1\10\22\2" + "\1\1\1\12\1\3\1\13\1\12\1\13\1\12\1\14"
|
||||
+ "\1\12\2\2\1\7\1\15\35\2\1\16\5\2\1\16" + "\40\2\1\1\1\13\1\0\2\14\5\2\1\15\25\2"
|
||||
+ "\1\16\30\2\1\16\4\2\1\16\11\2\1\1\5\2" + "\2\16\6\2\1\16\15\2\1\16\3\2\1\16\1\2" + "\1\1\14\2\1\1\6\2";
|
||||
|
||||
private static int[] zzUnpackAction() {
|
||||
int[] result = new int[241];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAction(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a state to a row index in the transition table
|
||||
*/
|
||||
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
|
||||
private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\63\0\146\0\231\0\314\0\377\0\u0132\0\u0165"
|
||||
+ "\0\u0132\0\u0198\0\u01cb\0\u0132\0\u01fe\0\u0132\0\u0132\0\u0231"
|
||||
+ "\0\u0264\0\u0297\0\u02ca\0\u02fd\0\u0330\0\u0363\0\u0396\0\u03c9"
|
||||
+ "\0\u03fc\0\u042f\0\u0462\0\u0495\0\u04c8\0\u04fb\0\u052e\0\u0561"
|
||||
+ "\0\u0594\0\u05c7\0\u05fa\0\u062d\0\u062d\0\u062d\0\u0660\0\u0693"
|
||||
+ "\0\u06c6\0\u06f9\0\u072c\0\u075f\0\u0792\0\u07c5\0\u0132\0\u07f8"
|
||||
+ "\0\u082b\0\u085e\0\u0891\0\u08c4\0\u08f7\0\u092a\0\u095d\0\u0990"
|
||||
+ "\0\u09c3\0\u09f6\0\u0a29\0\u0a5c\0\u0a8f\0\u0ac2\0\u0af5\0\u0b28"
|
||||
+ "\0\u0b5b\0\u0b8e\0\u0bc1\0\u0bf4\0\u0c27\0\u0c5a\0\u0c8d\0\u0cc0"
|
||||
+ "\0\u0cf3\0\u0d26\0\u0d59\0\u0d8c\0\u0dbf\0\u0df2\0\u0e25\0\u0e58"
|
||||
+ "\0\u0e8b\0\u0ebe\0\146\0\u0ef1\0\u0f24\0\u0f57\0\u0f8a\0\u0fbd"
|
||||
+ "\0\u0ff0\0\u1023\0\u1056\0\u1089\0\u10bc\0\u10ef\0\u1122\0\u1155"
|
||||
+ "\0\u1188\0\u11bb\0\u11ee\0\u1221\0\u1254\0\u1287\0\u12ba\0\u12ed"
|
||||
+ "\0\u1320\0\u1353\0\u1386\0\u13b9\0\u13ec\0\u141f\0\u1452\0\u1485"
|
||||
+ "\0\u14b8\0\u14eb\0\u151e\0\u1551\0\u1584\0\u15b7\0\u062d\0\u15ea"
|
||||
+ "\0\u161d\0\u1650\0\u1683\0\u16b6\0\u16e9\0\u01cb\0\u171c\0\u174f"
|
||||
+ "\0\u1782\0\u17b5\0\u17e8\0\u181b\0\u184e\0\u1881\0\u18b4\0\u18e7"
|
||||
+ "\0\u191a\0\u194d\0\u1980\0\u19b3\0\u19e6\0\u1a19\0\u1a4c\0\u1a7f"
|
||||
+ "\0\u1ab2\0\u1ae5\0\u1b18\0\u1b4b\0\u1b7e\0\u1bb1\0\u1be4\0\u1c17"
|
||||
+ "\0\u1c4a\0\u1c7d\0\u1cb0\0\u1ce3\0\u1d16\0\u1d49\0\u1d7c\0\u1daf"
|
||||
+ "\0\u1de2\0\u1e15\0\u1e48\0\u1e7b\0\u1eae\0\u1ee1\0\u1f14\0\u1f47"
|
||||
+ "\0\u1f7a\0\u1fad\0\u1fe0\0\u2013\0\u2046\0\u2079\0\u20ac\0\u20df"
|
||||
+ "\0\u2112\0\u2145\0\u2178\0\u21ab\0\u21de\0\u2211\0\u2244\0\u2277"
|
||||
+ "\0\u22aa\0\u22dd\0\u2310\0\u2343\0\u2376\0\u23a9\0\u23dc\0\u240f"
|
||||
+ "\0\u2442\0\u2475\0\u24a8\0\u24db\0\u250e\0\u2541\0\u2574\0\u25a7"
|
||||
+ "\0\u25da\0\u260d\0\u2640\0\u1b4b\0\u2673\0\u26a6\0\u26d9\0\u270c"
|
||||
+ "\0\u273f\0\u2772\0\u27a5\0\u27d8\0\u280b\0\u283e\0\u2871\0\u28a4"
|
||||
+ "\0\u28d7\0\u290a\0\u293d\0\u0bc1\0\u2970\0\u29a3\0\u29d6\0\u2a09"
|
||||
+ "\0\u260d\0\u2a3c\0\u2a6f\0\u2aa2\0\u2ad5\0\u2b08\0\u2b3b\0\u2b6e"
|
||||
+ "\0\u2ba1\0\u2bd4\0\u2c07\0\u2c3a\0\u2c6d\0\u2ca0\0\u2cd3\0\u2d06" + "\0\u2d39";
|
||||
|
||||
private static int[] zzUnpackRowMap() {
|
||||
int[] result = new int[241];
|
||||
int offset = 0;
|
||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int high = packed.charAt(i++) << 16;
|
||||
result[j++] = high | packed.charAt(i++);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table of the DFA
|
||||
*/
|
||||
private static final int[] ZZ_TRANS = zzUnpackTrans();
|
||||
private static final String ZZ_TRANS_PACKED_0 = "\1\2\1\3\1\4\1\5\1\3\1\4\1\6\1\7"
|
||||
+ "\1\10\1\2\1\3\1\11\1\12\1\13\4\3\1\14" + "\1\15\1\16\1\17\2\14\1\20\1\21\1\22\1\23"
|
||||
+ "\1\3\1\24\1\25\1\3\1\26\1\27\1\30\1\3" + "\1\31\1\3\1\32\1\33\1\34\1\3\1\35\1\36"
|
||||
+ "\1\37\1\40\1\41\1\42\2\4\1\3\7\2\1\0" + "\3\2\3\0\4\2\7\0\33\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\32\3\2\44\2\4" + "\1\44\1\4\1\44\1\0\3\44\3\0\1\44\1\45"
|
||||
+ "\1\46\1\47\1\0\1\50\5\0\2\44\1\47\1\44" + "\1\46\12\44\1\45\1\44\1\46\5\44\2\4\3\44"
|
||||
+ "\1\51\1\52\1\44\1\52\1\44\1\0\3\44\3\0" + "\1\53\1\45\1\46\1\47\1\0\1\50\5\0\2\44"
|
||||
+ "\1\47\1\44\1\46\7\44\1\53\2\44\1\45\1\44" + "\1\46\5\44\2\52\1\44\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\1\3\1\54\1\3" + "\1\55\26\3\63\0\13\10\1\0\47\10\14\0\1\12"
|
||||
+ "\46\0\11\13\1\56\3\13\1\57\45\13\2\0\2\50" + "\1\0\1\50\52\0\2\50\27\0\1\14\34\0\1\2"
|
||||
+ "\5\3\1\60\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\1\3\1\61\3\3\1\62\1\3\1\63\5\3"
|
||||
+ "\1\64\1\65\2\3\1\66\1\3\1\67\6\3\1\2" + "\5\3\1\70\1\0\1\2\1\43\1\3\3\0\4\3"
|
||||
+ "\7\0\1\71\4\3\1\72\2\3\1\73\2\3\1\74" + "\3\3\1\75\6\3\1\74\3\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\3\3\1\76" + "\1\3\1\77\2\3\1\100\3\3\1\101\2\3\1\102"
|
||||
+ "\1\103\11\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\2\3\1\104\5\3\1\105\21\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\1\106\1\3\1\107\5\3\1\110\21\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\1\111\1\3\1\112\2\3\1\113\2\3\1\114\1\3"
|
||||
+ "\1\115\1\116\16\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\1\3\1\117\30\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\2\3\1\120\27\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\3\3\1\121\5\3\1\122" + "\7\3\1\123\10\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\1\124\1\3\1\125\1\3" + "\1\123\3\3\1\126\6\3\1\127\5\3\1\130\4\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\1\3\1\131\1\132\4\3\1\133\1\134\2\3"
|
||||
+ "\1\111\1\3\1\135\10\3\1\136\2\3\1\137\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\1\140\4\3\1\141\2\3\1\142\2\3\1\143\2\3" + "\1\144\1\145\12\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\5\3\1\146\2\3\1\147" + "\1\150\1\3\1\151\3\3\1\152\12\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\2\3" + "\1\70\2\3\1\153\11\3\1\154\12\3\1\2\5\3"
|
||||
+ "\1\155\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\5\3\1\156\5\3\1\157\16\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\10\3\1\65" + "\21\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\6\3\1\160\4\3\1\161\16\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\11\3\1\123\1\3\1\162\11\3\1\163\4\3\6\2" + "\1\164\1\0\3\2\3\0\4\2\7\0\32\2\7\44"
|
||||
+ "\1\0\3\44\3\0\4\44\7\0\34\44\2\165\1\44" + "\1\165\1\44\1\0\3\44\3\0\4\44\1\166\6\0"
|
||||
+ "\27\44\2\165\3\44\2\50\1\44\1\50\1\44\1\0" + "\3\44\3\0\2\44\1\46\1\47\7\0\2\44\1\47"
|
||||
+ "\1\44\1\46\14\44\1\46\5\44\2\50\3\44\2\51" + "\1\44\1\51\1\44\1\0\3\44\3\0\2\44\1\46"
|
||||
+ "\1\47\1\0\1\50\5\0\2\44\1\47\1\44\1\46" + "\14\44\1\46\5\44\2\51\3\44\1\51\1\52\1\44"
|
||||
+ "\1\52\1\44\1\0\3\44\3\0\1\44\1\167\1\46" + "\1\47\1\0\1\50\5\0\2\44\1\47\1\44\1\46"
|
||||
+ "\12\44\1\167\1\44\1\46\5\44\2\52\3\44\4\170" + "\1\44\1\0\3\44\3\0\2\44\2\170\7\0\1\170"
|
||||
+ "\1\44\1\170\1\44\1\170\10\44\1\170\3\44\1\170" + "\1\44\1\170\3\44\2\170\1\44\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\4\3\1\171" + "\12\3\1\172\1\173\11\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\12\3\1\174\3\3" + "\1\175\13\3\13\13\1\0\1\13\1\176\45\13\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\7\3\1\177\22\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\1\3\1\200\30\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\5\3\1\201\24\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\1\202\31\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\10\3" + "\1\67\21\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\13\3\1\203\16\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\7\3"
|
||||
+ "\1\204\22\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\16\3\1\123\13\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\7\3" + "\1\67\22\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\15\3\1\205\14\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\10\3"
|
||||
+ "\1\206\21\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\26\3\1\123\3\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\4\3" + "\1\123\25\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\1\207\31\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\7\3\1\210"
|
||||
+ "\22\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\5\3\1\211\24\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\21\3\1\123" + "\10\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\1\3\1\212\1\206\10\3\1\213\16\3" + "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3"
|
||||
+ "\7\0\16\3\1\214\13\3\1\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\1\215\31\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\16\3\1\216\13\3\1\2\5\3\1\217\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\32\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\4\3"
|
||||
+ "\1\220\6\3\1\221\16\3\1\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\1\74\2\3\1\146"
|
||||
+ "\3\3\1\222\12\3\1\223\7\3\1\2\5\3\1\157" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\32\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\3\3\1\224\26\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\14\3\1\213\2\3" + "\1\215\12\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\1\225\31\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\1\3\1\226"
|
||||
+ "\30\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\2\3\1\227\23\3\1\230\3\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\11\3\1\231\20\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\2\3\1\203\4\3\1\232" + "\22\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\3\3\1\233\12\3\1\234\13\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\7\3\1\123\5\3\1\212\3\3\1\235\10\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\1\236\31\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\3\3\1\237\3\3\1\240\22\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\13\3\1\215\16\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\3\3\1\241\12\3" + "\1\224\13\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\10\3\1\221\21\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\2\3"
|
||||
+ "\1\242\27\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\17\3\1\243\12\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\2\3" + "\1\205\1\74\3\3\1\123\7\3\1\244\12\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\5\3\1\245\24\3\1\2\5\3\1\246\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\32\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\1\247"
|
||||
+ "\4\3\1\250\24\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\13\3\1\251\16\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\5\3\1\213\24\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\1\3\1\61\21\3\1\252" + "\6\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\1\253\1\3\1\254\27\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\22\3"
|
||||
+ "\1\255\3\3\1\204\3\3\1\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\3\3\1\256\12\3"
|
||||
+ "\1\257\13\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\2\3\1\260\5\3\1\137\21\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\2\3\1\261\27\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\1\116\31\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\5\3\1\262\7\3\1\263\14\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\10\3\1\74"
|
||||
+ "\21\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\17\3\1\231\12\3\1\2\5\3\1\264"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\10\3" + "\1\211\21\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\1\265\31\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\10\3\1\266"
|
||||
+ "\21\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\7\3\1\267\22\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\2\3\1\270" + "\27\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\3\3\1\74\26\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\1\3\1\271"
|
||||
+ "\30\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\16\3\1\272\13\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\3\3\1\273" + "\26\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\13\3\1\151\16\3\2\2\4\274\1\2" + "\1\0\3\2\3\0\2\2\2\274\7\0\1\274\1\2"
|
||||
+ "\1\274\1\2\1\274\10\2\1\274\3\2\1\274\1\2" + "\1\274\3\2\2\274\1\2\2\44\2\165\1\44\1\165"
|
||||
+ "\1\44\1\0\3\44\3\0\2\44\1\46\1\44\7\0" + "\4\44\1\46\14\44\1\46\5\44\2\165\1\44\2\0"
|
||||
+ "\2\165\1\0\1\165\52\0\2\165\1\0\2\44\4\170" + "\1\44\1\0\3\44\3\0\1\44\1\167\2\170\7\0"
|
||||
+ "\1\170\1\44\1\170\1\44\1\170\10\44\1\170\1\44" + "\1\167\1\44\1\170\1\44\1\170\3\44\2\170\1\44"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\1\275\31\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\2\3\1\276\27\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\1\212\31\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\10\3\1\277\21\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\2\3" + "\1\213\27\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\10\3\1\300\21\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\2\3"
|
||||
+ "\1\157\27\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\1\301\31\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\3\3\1\302" + "\26\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\3\3\1\123\26\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\2\3\1\212"
|
||||
+ "\27\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\12\3\1\123\17\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\15\3\1\123" + "\14\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\15\3\1\204\14\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\5\3\1\301"
|
||||
+ "\24\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\10\3\1\212\21\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\5\3\1\123" + "\24\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\7\3\1\123\22\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\2\3\1\303"
|
||||
+ "\27\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\17\3\1\123\12\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\7\3\1\304" + "\22\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\23\3\1\151\6\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\13\3\1\305"
|
||||
+ "\16\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\16\3\1\231\13\3\1\2\5\3\1\306"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\32\3" + "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3"
|
||||
+ "\7\0\2\3\1\307\13\3\1\310\13\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\25\3"
|
||||
+ "\1\123\4\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\15\3\1\231\14\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\17\3" + "\1\172\12\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\5\3\1\77\24\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\1\243"
|
||||
+ "\31\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\2\3\1\123\27\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\13\3\1\311" + "\16\3\1\2\5\3\1\312\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\32\3\1\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\16\3\1\122\13\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\10\3\1\123\21\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\22\3\1\231\7\3" + "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3"
|
||||
+ "\7\0\20\3\1\313\11\3\1\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\15\3\1\314\14\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\7\3\1\315\5\3\1\316\1\317\13\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\15\3\1\320\14\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\13\3\1\213\16\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\2\3\1\321\27\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\13\3\1\322\16\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\5\3\1\225\24\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\3\3\1\123\13\3\1\231" + "\12\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\10\3\1\323\21\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\7\3\1\240"
|
||||
+ "\22\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\2\3\1\215\27\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\3\3\1\236" + "\26\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\1\3\1\324\30\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\30\3\1\325"
|
||||
+ "\1\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\4\3\1\326\11\3\1\327\13\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\7\3\1\330\22\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\1\331\31\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\3\3"
|
||||
+ "\1\332\26\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\2\3\1\333\6\3\1\316\20\3"
|
||||
+ "\1\2\5\3\1\67\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\32\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\16\3\1\314\13\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\23\3\1\123\6\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\23\3\1\334\6\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\7\3\1\311\22\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\1\205\31\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\10\3"
|
||||
+ "\1\213\21\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\7\3\1\335\22\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\21\3" + "\1\235\10\3\2\2\4\336\1\2\1\0\3\2\3\0"
|
||||
+ "\2\2\2\336\7\0\1\336\1\2\1\336\1\2\1\336" + "\10\2\1\336\3\2\1\336\1\2\1\336\3\2\2\336"
|
||||
+ "\2\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\7\3\1\231\22\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\20\3\1\252\11\3" + "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3"
|
||||
+ "\7\0\26\3\1\203\3\3\1\2\6\3\1\0\1\2" + "\1\43\1\337\3\0\4\3\7\0\32\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\6\3" + "\1\123\23\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\27\3\1\123\2\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\13\3"
|
||||
+ "\1\100\16\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\5\3\1\340\24\3\1\2\6\3"
|
||||
+ "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\10\3" + "\1\341\21\3\1\2\6\3\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\5\3\1\203\24\3\1\2\6\3" + "\1\0\1\2\1\43\1\3\3\0\4\3\7\0\14\3"
|
||||
+ "\1\342\15\3\1\2\5\3\1\265\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\32\3\1\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\10\3\1\203" + "\21\3\1\2\6\3\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\23\3\1\343\6\3\1\2\6\3\1\0" + "\1\2\1\43\1\3\3\0\4\3\7\0\1\67\31\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\13\3\1\344\16\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\1\213\31\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\10\3\1\151\21\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\12\3\1\341\17\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\15\3\1\345\14\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\3\3\1\346\26\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\17\3\1\347\12\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\17\3\1\113\12\3\1\2"
|
||||
+ "\2\3\1\123\3\3\1\0\1\2\1\43\1\3\3\0" + "\4\3\7\0\32\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\2\3\1\350\27\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\2\3\1\137\27\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\23\3\1\351\6\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\5\3\1\240\24\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\22\3\1\352\7\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\1\240\31\3\1\2\6\3\1\0\1\2\1\43\1\3" + "\3\0\4\3\7\0\10\3\1\210\21\3\2\2\4\353"
|
||||
+ "\1\2\1\0\3\2\3\0\2\2\2\353\7\0\1\353" + "\1\2\1\353\1\2\1\353\10\2\1\353\3\2\1\353"
|
||||
+ "\1\2\1\353\3\2\2\353\2\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\11\3\1\354\20\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\10\3\1\301\21\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\1\3\1\123\30\3" + "\1\2\5\3\1\155\1\0\1\2\1\43\1\3\3\0"
|
||||
+ "\4\3\7\0\32\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\3\3\1\355\26\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\7\3\1\232\22\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\22\3\1\123\7\3\1\2" + "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0"
|
||||
+ "\17\3\1\356\12\3\1\2\6\3\1\0\1\2\1\43" + "\1\3\3\0\4\3\7\0\14\3\1\123\15\3\1\2"
|
||||
+ "\6\3\1\0\1\2\1\43\1\3\3\0\4\3\7\0" + "\10\3\1\350\21\3\1\2\6\3\1\0\1\2\1\43"
|
||||
+ "\1\3\3\0\4\3\7\0\7\3\1\314\22\3\2\2" + "\4\3\1\2\1\0\3\2\3\0\2\2\2\3\7\0"
|
||||
+ "\1\3\1\2\1\3\1\2\1\3\10\2\1\3\3\2" + "\1\3\1\2\1\3\3\2\2\3\2\2\6\3\1\0"
|
||||
+ "\1\2\1\43\1\3\3\0\4\3\7\0\12\3\1\357" + "\17\3\1\2\5\3\1\231\1\0\1\2\1\43\1\3"
|
||||
+ "\3\0\4\3\7\0\32\3\1\2\6\3\1\0\1\2" + "\1\43\1\3\3\0\4\3\7\0\23\3\1\173\6\3"
|
||||
+ "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\13\3\1\360\16\3\1\2\6\3\1\0\1\2"
|
||||
+ "\1\43\1\3\3\0\4\3\7\0\3\3\1\361\26\3" + "\1\2\6\3\1\0\1\2\1\43\1\3\3\0\4\3" + "\7\0\4\3\1\326\25\3";
|
||||
|
||||
private static int[] zzUnpackTrans() {
|
||||
int[] result = new int[11628];
|
||||
int offset = 0;
|
||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackTrans(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
value--;
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/* error codes */
|
||||
private static final int ZZ_UNKNOWN_ERROR = 0;
|
||||
private static final int ZZ_NO_MATCH = 1;
|
||||
private static final int ZZ_PUSHBACK_2BIG = 2;
|
||||
/* error messages for the codes above */
|
||||
private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input",
|
||||
"Error: pushback value was too large" };
|
||||
/**
|
||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
||||
*/
|
||||
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||
private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\5\1\1\11\1\1\1\11\2\1\1\11\1\1"
|
||||
+ "\2\11\37\1\1\11\106\1\1\0\173\1";
|
||||
|
||||
private static int[] zzUnpackAttribute() {
|
||||
int[] result = new int[241];
|
||||
int offset = 0;
|
||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
|
||||
int i = 0; /* index in packed string */
|
||||
int j = offset; /* index in unpacked array */
|
||||
int l = packed.length();
|
||||
while (i < l) {
|
||||
int count = packed.charAt(i++);
|
||||
int value = packed.charAt(i++);
|
||||
do
|
||||
result[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/** the input device */
|
||||
private java.io.Reader zzReader;
|
||||
/** the current state of the DFA */
|
||||
private int zzState;
|
||||
/** the current lexical state */
|
||||
private int zzLexicalState = YYINITIAL;
|
||||
/**
|
||||
* this buffer contains the current text to be matched and is the source of the
|
||||
* yytext() string
|
||||
*/
|
||||
private char zzBuffer[];
|
||||
/** the textposition at the last accepting state */
|
||||
private int zzMarkedPos;
|
||||
/** the current text position in the buffer */
|
||||
private int zzCurrentPos;
|
||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
||||
private int zzStartRead;
|
||||
/**
|
||||
* endRead marks the last character in the buffer, that has been read from input
|
||||
*/
|
||||
private int zzEndRead;
|
||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||
private boolean zzAtEOF;
|
||||
/* user code: */
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a no-parameter
|
||||
* constructor.
|
||||
*/
|
||||
public TclTokenMaker() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos - 1, tokenType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start, end, tokenType, so);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start, end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated from
|
||||
* <code>text</code>. This method must be implemented by subclasses so they can
|
||||
* correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing the syntax
|
||||
* highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
// Start off in the proper state.
|
||||
int state = Token.NULL;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos >= s.offset + s.count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream. Does not close the old
|
||||
* reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream <b>cannot</b> be
|
||||
* reused (internal buffer is discarded and lost). Lexical state is set to
|
||||
* <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill no longer
|
||||
* "refills" the buffer (since the way we do it, it's always "full" the first
|
||||
* time through, since it points to the segment's array). So, we assign
|
||||
* zzEndRead here.
|
||||
*/
|
||||
// zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner There is also a java.io.InputStream version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Reader to read input from.
|
||||
*/
|
||||
public TclTokenMaker(java.io.Reader in) {
|
||||
this.zzReader = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scanner. There is also java.io.Reader version of this
|
||||
* constructor.
|
||||
*
|
||||
* @param in the java.io.Inputstream to read input from.
|
||||
*/
|
||||
public TclTokenMaker(java.io.InputStream in) {
|
||||
this(new java.io.InputStreamReader(in));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpacks the compressed character translation table.
|
||||
*
|
||||
* @param packed the packed character translation table
|
||||
* @return the unpacked character translation table
|
||||
*/
|
||||
private static char[] zzUnpackCMap(String packed) {
|
||||
char[] map = new char[0x10000];
|
||||
int i = 0; /* index in packed string */
|
||||
int j = 0; /* index in unpacked array */
|
||||
while (i < 160) {
|
||||
int count = packed.charAt(i++);
|
||||
char value = packed.charAt(i++);
|
||||
do
|
||||
map[j++] = value;
|
||||
while (--count > 0);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
zzAtEOF = true; /* indicate end of file */
|
||||
zzEndRead = zzStartRead; /* invalidate buffer */
|
||||
if (zzReader != null)
|
||||
zzReader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters a new lexical state
|
||||
*
|
||||
* @param newState the new lexical state
|
||||
*/
|
||||
@Override
|
||||
public final void yybegin(int newState) {
|
||||
zzLexicalState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character at position <tt>pos</tt> from the matched text.
|
||||
*
|
||||
* It is equivalent to yytext().charAt(pos), but faster
|
||||
*
|
||||
* @param pos the position of the character to fetch. A value from 0 to
|
||||
* yylength()-1.
|
||||
*
|
||||
* @return the character at position pos
|
||||
*/
|
||||
public final char yycharat(int pos) {
|
||||
return zzBuffer[zzStartRead + pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occured while scanning.
|
||||
*
|
||||
* In a wellformed scanner (no or only correct usage of yypushback(int) and a
|
||||
* match-all fallback rule) this method will only be called with things that
|
||||
* "Can't Possibly Happen". If this method is called, something is seriously
|
||||
* wrong (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||
*
|
||||
* Usual syntax/scanner level error handling should be done in error fallback
|
||||
* rules.
|
||||
*
|
||||
* @param errorCode the code of the errormessage to display
|
||||
*/
|
||||
private void zzScanError(int errorCode) {
|
||||
String message;
|
||||
try {
|
||||
message = ZZ_ERROR_MSG[errorCode];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the specified amount of characters back into the input stream.
|
||||
*
|
||||
* They will be read again by then next call of the scanning method
|
||||
*
|
||||
* @param number the number of characters to be read again. This number must not
|
||||
* be greater than yylength()!
|
||||
*/
|
||||
public void yypushback(int number) {
|
||||
if (number > yylength())
|
||||
zzScanError(ZZ_PUSHBACK_2BIG);
|
||||
zzMarkedPos -= number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resumes scanning until the next regular expression is matched, the end of
|
||||
* input is encountered or an I/O-Error occurs.
|
||||
*
|
||||
* @return the next token
|
||||
* @exception java.io.IOException if any I/O-Error occurs
|
||||
*/
|
||||
public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
||||
int zzInput;
|
||||
int zzAction;
|
||||
// cached fields:
|
||||
int zzCurrentPosL;
|
||||
int zzMarkedPosL;
|
||||
int zzEndReadL = zzEndRead;
|
||||
char[] zzBufferL = zzBuffer;
|
||||
char[] zzCMapL = ZZ_CMAP;
|
||||
int[] zzTransL = ZZ_TRANS;
|
||||
int[] zzRowMapL = ZZ_ROWMAP;
|
||||
int[] zzAttrL = ZZ_ATTRIBUTE;
|
||||
while (true) {
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzAction = -1;
|
||||
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
||||
zzState = zzLexicalState;
|
||||
zzForAction: {
|
||||
while (true) {
|
||||
if (zzCurrentPosL < zzEndReadL)
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
else if (zzAtEOF) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
// store back cached positions
|
||||
zzCurrentPos = zzCurrentPosL;
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
boolean eof = zzRefill();
|
||||
// get translated positions and possibly new buffer
|
||||
zzCurrentPosL = zzCurrentPos;
|
||||
zzMarkedPosL = zzMarkedPos;
|
||||
zzBufferL = zzBuffer;
|
||||
zzEndReadL = zzEndRead;
|
||||
if (eof) {
|
||||
zzInput = YYEOF;
|
||||
break zzForAction;
|
||||
} else {
|
||||
zzInput = zzBufferL[zzCurrentPosL++];
|
||||
}
|
||||
}
|
||||
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
|
||||
if (zzNext == -1)
|
||||
break zzForAction;
|
||||
zzState = zzNext;
|
||||
int zzAttributes = zzAttrL[zzState];
|
||||
if ((zzAttributes & 1) == 1) {
|
||||
zzAction = zzState;
|
||||
zzMarkedPosL = zzCurrentPosL;
|
||||
if ((zzAttributes & 8) == 8)
|
||||
break zzForAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store back cached position
|
||||
zzMarkedPos = zzMarkedPosL;
|
||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||
case 14: {
|
||||
addToken(Token.RESERVED_WORD);
|
||||
}
|
||||
case 15:
|
||||
break;
|
||||
case 2: {
|
||||
addToken(Token.IDENTIFIER);
|
||||
}
|
||||
case 16:
|
||||
break;
|
||||
case 13: {
|
||||
addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
}
|
||||
case 17:
|
||||
break;
|
||||
case 11: {
|
||||
addToken(Token.LITERAL_NUMBER_FLOAT);
|
||||
}
|
||||
case 18:
|
||||
break;
|
||||
case 4: {
|
||||
addToken(Token.COMMENT_EOL);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 19:
|
||||
break;
|
||||
case 6: {
|
||||
addToken(Token.WHITESPACE);
|
||||
}
|
||||
case 20:
|
||||
break;
|
||||
case 10: {
|
||||
addToken(Token.ERROR_NUMBER_FORMAT);
|
||||
}
|
||||
case 21:
|
||||
break;
|
||||
case 1: {
|
||||
addToken(Token.ERROR_IDENTIFIER);
|
||||
}
|
||||
case 22:
|
||||
break;
|
||||
case 12: {
|
||||
addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
|
||||
}
|
||||
case 23:
|
||||
break;
|
||||
case 8: {
|
||||
addToken(Token.OPERATOR);
|
||||
}
|
||||
case 24:
|
||||
break;
|
||||
case 3: {
|
||||
addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||
}
|
||||
case 25:
|
||||
break;
|
||||
case 7: {
|
||||
addToken(Token.ERROR_STRING_DOUBLE);
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 26:
|
||||
break;
|
||||
case 5: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 27:
|
||||
break;
|
||||
case 9: {
|
||||
addToken(Token.SEPARATOR);
|
||||
}
|
||||
case 28:
|
||||
break;
|
||||
default:
|
||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||
zzAtEOF = true;
|
||||
switch (zzLexicalState) {
|
||||
case YYINITIAL: {
|
||||
addNullToken();
|
||||
return firstToken;
|
||||
}
|
||||
case 242:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
zzScanError(ZZ_NO_MATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,951 +0,0 @@
|
||||
/*
|
||||
* 11/24/2015
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for TypeScript files. Currently it is a clone of
|
||||
* {@code JavaScriptTokenMaker}, but it should diverge over time to match
|
||||
* the added features of TypeScript.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>TypeScriptTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 0.9
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class TypeScriptTokenMaker
|
||||
%extends AbstractJFlexCTokenMaker
|
||||
%unicode
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a JavaScript multiline comment.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_MLC = -8;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a JavaScript documentation comment.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_COMMENT_DOCUMENTATION = -9;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line JS string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_STRING_INVALID = -10;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line JS string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_STRING_VALID = -11;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line JS single-quoted string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_CHAR_INVALID = -12;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line JS single-quoted string.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_CHAR_VALID = -13;
|
||||
|
||||
private static final int INTERNAL_E4X = -14;
|
||||
|
||||
private static final int INTERNAL_E4X_INTAG = -15;
|
||||
|
||||
private static final int INTERNAL_E4X_MARKUP_PROCESSING_INSTRUCTION = -16;
|
||||
|
||||
private static final int INTERNAL_IN_E4X_COMMENT = -17;
|
||||
|
||||
private static final int INTERNAL_E4X_DTD = -18;
|
||||
|
||||
private static final int INTERNAL_E4X_DTD_INTERNAL = -19;
|
||||
|
||||
private static final int INTERNAL_E4X_ATTR_SINGLE = -20;
|
||||
|
||||
private static final int INTERNAL_E4X_ATTR_DOUBLE = -21;
|
||||
|
||||
private static final int INTERNAL_E4X_MARKUP_CDATA = -22;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in a valid multi-line template literal.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID = -23;
|
||||
|
||||
/**
|
||||
* Token type specifying we're in an invalid multi-line template literal.
|
||||
*/
|
||||
private static final int INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID = -24;
|
||||
|
||||
/**
|
||||
* When in the JS_STRING state, whether the current string is valid.
|
||||
*/
|
||||
private boolean validJSString;
|
||||
|
||||
/**
|
||||
* Whether we're in an internal DTD. Only valid if in an e4x DTD.
|
||||
*/
|
||||
private boolean e4x_inInternalDtd;
|
||||
|
||||
/**
|
||||
* The previous e4x state. Only valid if in an e4x state.
|
||||
*/
|
||||
private int e4x_prevState;
|
||||
|
||||
/**
|
||||
* Whether e4x is being highlighted.
|
||||
*/
|
||||
private static boolean e4xSupported;
|
||||
|
||||
/**
|
||||
* Language state set on JS tokens. Must be 0.
|
||||
*/
|
||||
private static final int LANG_INDEX_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* Language state set on E4X tokens.
|
||||
*/
|
||||
private static final int LANG_INDEX_E4X = 1;
|
||||
|
||||
private Stack<Boolean> varDepths;
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public TypeScriptTokenMaker() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
e4xSupported = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens as an
|
||||
* "end token;" that is, at <code>zzMarkedPos</code>.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addEndToken(int tokenType) {
|
||||
addToken(zzMarkedPos,zzMarkedPos, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
||||
super.addToken(array, start,end, tokenType, startOffset);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the closest {@link TokenTypes} "standard" token type for a given
|
||||
* "internal" token type (e.g. one whose value is <code>< 0</code>).
|
||||
*/
|
||||
@Override
|
||||
public int getClosestStandardTokenTypeForInternalType(int type) {
|
||||
switch (type) {
|
||||
case INTERNAL_IN_JS_MLC:
|
||||
return TokenTypes.COMMENT_MULTILINE;
|
||||
case INTERNAL_IN_JS_COMMENT_DOCUMENTATION:
|
||||
return TokenTypes.COMMENT_DOCUMENTATION;
|
||||
case INTERNAL_IN_JS_STRING_INVALID:
|
||||
case INTERNAL_IN_JS_STRING_VALID:
|
||||
case INTERNAL_IN_JS_CHAR_INVALID:
|
||||
case INTERNAL_IN_JS_CHAR_VALID:
|
||||
return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID:
|
||||
return TokenTypes.LITERAL_BACKQUOTE;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID:
|
||||
return TokenTypes.ERROR_STRING_DOUBLE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "//", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
validJSString = true;
|
||||
e4x_prevState = YYINITIAL;
|
||||
e4x_inInternalDtd = false;
|
||||
int languageIndex = LANG_INDEX_DEFAULT;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
switch (initialTokenType) {
|
||||
case INTERNAL_IN_JS_MLC:
|
||||
state = JS_MLC;
|
||||
break;
|
||||
case INTERNAL_IN_JS_COMMENT_DOCUMENTATION:
|
||||
state = JS_DOCCOMMENT;
|
||||
start = text.offset;
|
||||
break;
|
||||
case INTERNAL_IN_JS_STRING_INVALID:
|
||||
state = JS_STRING;
|
||||
validJSString = false;
|
||||
break;
|
||||
case INTERNAL_IN_JS_STRING_VALID:
|
||||
state = JS_STRING;
|
||||
break;
|
||||
case INTERNAL_IN_JS_CHAR_INVALID:
|
||||
state = JS_CHAR;
|
||||
validJSString = false;
|
||||
break;
|
||||
case INTERNAL_IN_JS_CHAR_VALID:
|
||||
state = JS_CHAR;
|
||||
break;
|
||||
case INTERNAL_E4X:
|
||||
state = E4X;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_INTAG:
|
||||
state = E4X_INTAG;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_MARKUP_PROCESSING_INSTRUCTION:
|
||||
state = E4X_PI;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_DTD:
|
||||
state = E4X_DTD;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_DTD_INTERNAL:
|
||||
state = E4X_DTD;
|
||||
e4x_inInternalDtd = true;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_ATTR_SINGLE:
|
||||
state = E4X_INATTR_SINGLE;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_ATTR_DOUBLE:
|
||||
state = E4X_INATTR_DOUBLE;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_E4X_MARKUP_CDATA:
|
||||
state = E4X_CDATA;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
break;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID:
|
||||
state = JS_TEMPLATE_LITERAL;
|
||||
validJSString = true;
|
||||
break;
|
||||
case INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID:
|
||||
state = JS_TEMPLATE_LITERAL;
|
||||
validJSString = false;
|
||||
break;
|
||||
default:
|
||||
if (initialTokenType<-1024) { // INTERNAL_IN_E4X_COMMENT - prevState
|
||||
int main = -(-initialTokenType & 0xffffff00);
|
||||
switch (main) {
|
||||
default: // Should never happen
|
||||
case INTERNAL_IN_E4X_COMMENT:
|
||||
state = E4X_COMMENT;
|
||||
break;
|
||||
}
|
||||
e4x_prevState = -initialTokenType&0xff;
|
||||
languageIndex = LANG_INDEX_E4X;
|
||||
}
|
||||
else { // Shouldn't happen
|
||||
state = Token.NULL;
|
||||
}
|
||||
}
|
||||
|
||||
setLanguageIndex(languageIndex);
|
||||
start = text.offset;
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether e4x is being highlighted.
|
||||
*
|
||||
* @return Whether e4x is being highlighted.
|
||||
* @see #setE4xSupported(boolean)
|
||||
*/
|
||||
public static boolean isE4xSupported() {
|
||||
return e4xSupported;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether e4x should be highlighted. A repaint should be forced on
|
||||
* all <code>RSyntaxTextArea</code>s editing JavaScript if this property
|
||||
* is changed to see the difference.
|
||||
*
|
||||
* @param supported Whether e4x should be highlighted.
|
||||
* @see #isE4xSupported()
|
||||
*/
|
||||
public static void setE4xSupported(boolean supported) {
|
||||
e4xSupported = supported;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Whitespace = ([ \t\f]+)
|
||||
LineTerminator = ([\n])
|
||||
|
||||
Letter = [A-Za-z]
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
OctalDigit = ([0-7])
|
||||
LetterOrDigit = ({Letter}|{Digit})
|
||||
EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'\`]|"#"|"\\")
|
||||
IdentifierStart = ({Letter}|"_"|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
|
||||
JS_MLCBegin = "/*"
|
||||
JS_DocCommentBegin = "/**"
|
||||
JS_MLCEnd = "*/"
|
||||
JS_LineCommentBegin = "//"
|
||||
JS_IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
|
||||
JS_IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
|
||||
JS_IntegerLiteral = ({JS_IntegerHelper1}[lL]?)
|
||||
JS_HexLiteral = ({JS_IntegerHelper2}[lL]?)
|
||||
JS_FloatHelper1 = ([fFdD]?)
|
||||
JS_FloatHelper2 = ([eE][+-]?{Digit}+{JS_FloatHelper1})
|
||||
JS_FloatLiteral1 = ({Digit}+"."({JS_FloatHelper1}|{JS_FloatHelper2}|{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2})))
|
||||
JS_FloatLiteral2 = ("."{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2}))
|
||||
JS_FloatLiteral3 = ({Digit}+{JS_FloatHelper2})
|
||||
JS_FloatLiteral = ({JS_FloatLiteral1}|{JS_FloatLiteral2}|{JS_FloatLiteral3}|({Digit}+[fFdD]))
|
||||
JS_ErrorNumberFormat = (({JS_IntegerLiteral}|{JS_HexLiteral}|{JS_FloatLiteral}){NonSeparator}+)
|
||||
JS_Separator = ([\(\)\{\}\[\]\]])
|
||||
JS_Separator2 = ([\;,.])
|
||||
JS_NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"||"|"&&"|">>>")
|
||||
JS_AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
|
||||
JS_Operator = ({JS_NonAssignmentOperator}|{JS_AssignmentOperator})
|
||||
JS_Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
JS_ErrorIdentifier = ({NonSeparator}+)
|
||||
JS_Regex = ("/"([^\*\\/]|\\.)([^/\\]|\\.)*"/"[gim]*)
|
||||
JS_E4xAttribute = ("@"{Letter}{LetterOrDigit}*)
|
||||
|
||||
JS_BlockTag = ("abstract"|"access"|"alias"|"augments"|"author"|"borrows"|
|
||||
"callback"|"classdesc"|"constant"|"constructor"|"constructs"|
|
||||
"copyright"|"default"|"deprecated"|"desc"|"enum"|"event"|
|
||||
"example"|"exports"|"external"|"file"|"fires"|"global"|
|
||||
"ignore"|"inner"|"instance"|"kind"|"lends"|"license"|
|
||||
"link"|"member"|"memberof"|"method"|"mixes"|"mixin"|"module"|
|
||||
"name"|"namespace"|"param"|"private"|"property"|"protected"|
|
||||
"public"|"readonly"|"requires"|"return"|"returns"|"see"|"since"|
|
||||
"static"|"summary"|"this"|"throws"|"todo"|
|
||||
"type"|"typedef"|"variation"|"version")
|
||||
JS_InlineTag = ("link"|"linkplain"|"linkcode"|"tutorial")
|
||||
JS_TemplateLiteralExprStart = ("${")
|
||||
|
||||
e4x_NameStartChar = ([\:A-Z_a-z])
|
||||
e4x_NameChar = ({e4x_NameStartChar}|[\-\.0-9])
|
||||
e4x_TagName = ({e4x_NameStartChar}{e4x_NameChar}*)
|
||||
e4x_Identifier = ([^ \t\n<&;]+)
|
||||
e4x_EndXml = ([;])
|
||||
e4x_EntityReference = ([&][^; \t]*[;]?)
|
||||
e4x_InTagIdentifier = ([^ \t\n\"\'=\/>]+)
|
||||
e4x_CDataBegin = ("<![CDATA[")
|
||||
e4x_CDataEnd = ("]]>")
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrDigit}|"_"|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{LetterOrDigit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
|
||||
%state JS_STRING
|
||||
%state JS_CHAR
|
||||
%state JS_MLC
|
||||
%state JS_DOCCOMMENT
|
||||
%state JS_EOL_COMMENT
|
||||
%state E4X
|
||||
%state E4X_COMMENT
|
||||
%state E4X_PI
|
||||
%state E4X_DTD
|
||||
%state E4X_INTAG
|
||||
%state E4X_INATTR_DOUBLE
|
||||
%state E4X_INATTR_SINGLE
|
||||
%state E4X_CDATA
|
||||
%state JS_TEMPLATE_LITERAL
|
||||
%state JS_TEMPLATE_LITERAL_EXPR
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
// ECMA and TypeScript keywords
|
||||
"break" |
|
||||
"case" |
|
||||
"catch" |
|
||||
"class" |
|
||||
"const" |
|
||||
"continue" |
|
||||
"debugger" |
|
||||
"default" |
|
||||
"delete" |
|
||||
"do" |
|
||||
"else" |
|
||||
"export" |
|
||||
"extends" |
|
||||
"finally" |
|
||||
"for" |
|
||||
"function" |
|
||||
"if" |
|
||||
"import" |
|
||||
"in" |
|
||||
"instanceof" |
|
||||
"module" |
|
||||
"new" |
|
||||
"super" |
|
||||
"switch" |
|
||||
"this" |
|
||||
"throw" |
|
||||
"try" |
|
||||
"typeof" |
|
||||
"var" |
|
||||
"void" |
|
||||
"while" |
|
||||
"with" { addToken(Token.RESERVED_WORD); }
|
||||
"return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
//e4X
|
||||
"each" {if(e4xSupported){ addToken(Token.RESERVED_WORD);} else {addToken(Token.IDENTIFIER);} }
|
||||
//JavaScript 1.7
|
||||
"let" { addToken(Token.RESERVED_WORD); }
|
||||
// e4x miscellaneous
|
||||
{JS_E4xAttribute} { addToken(isE4xSupported() ? Token.MARKUP_TAG_ATTRIBUTE : Token.ERROR_IDENTIFIER); }
|
||||
|
||||
// TypeScript data types
|
||||
"any" |
|
||||
"boolean" |
|
||||
"number" |
|
||||
"string" |
|
||||
|
||||
// Reserved ECMA keywords that represent types (older specs, 1-3)
|
||||
"byte" |
|
||||
"char" |
|
||||
"double" |
|
||||
"float" |
|
||||
"int" |
|
||||
"long" |
|
||||
"short" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
// Reserved words, mostly from older standards
|
||||
"abstract" |
|
||||
"enum" |
|
||||
"final" |
|
||||
"goto" |
|
||||
"implements" |
|
||||
"interface" |
|
||||
"native" |
|
||||
"package" |
|
||||
"private" |
|
||||
"protected" |
|
||||
"public" |
|
||||
"static" |
|
||||
"synchronized" |
|
||||
"throws" |
|
||||
"transient" |
|
||||
"volatile" |
|
||||
"null" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
// Literals.
|
||||
"false" |
|
||||
"true" { addToken(Token.LITERAL_BOOLEAN); }
|
||||
"NaN" |
|
||||
"Infinity" { addToken(Token.RESERVED_WORD); }
|
||||
|
||||
// Functions.
|
||||
"eval" |
|
||||
"parseInt" |
|
||||
"parseFloat" |
|
||||
"escape" |
|
||||
"unescape" |
|
||||
"isNaN" |
|
||||
"isFinite" { addToken(Token.FUNCTION); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
{JS_Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
|
||||
/* String/Character literals. */
|
||||
[\'] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_CHAR); }
|
||||
[\"] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_STRING); }
|
||||
[\`] { start = zzMarkedPos-1; validJSString = true; yybegin(JS_TEMPLATE_LITERAL); }
|
||||
|
||||
/* Comment literals. */
|
||||
"/**/" { addToken(Token.COMMENT_MULTILINE); }
|
||||
{JS_MLCBegin} { start = zzMarkedPos-2; yybegin(JS_MLC); }
|
||||
{JS_DocCommentBegin} { start = zzMarkedPos-3; yybegin(JS_DOCCOMMENT); }
|
||||
{JS_LineCommentBegin} { start = zzMarkedPos-2; yybegin(JS_EOL_COMMENT); }
|
||||
|
||||
/* Attempt to identify regular expressions (not foolproof) - do after comments! */
|
||||
{JS_Regex} {
|
||||
boolean highlightedAsRegex = false;
|
||||
if (firstToken==null) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
else {
|
||||
// If this is *likely* to be a regex, based on
|
||||
// the previous token, highlight it as such.
|
||||
Token t = firstToken.getLastNonCommentNonWhitespaceToken();
|
||||
if (RSyntaxUtilities.regexCanFollowInJavaScript(t)) {
|
||||
addToken(Token.REGEX);
|
||||
highlightedAsRegex = true;
|
||||
}
|
||||
}
|
||||
// If it doesn't *appear* to be a regex, highlight it as
|
||||
// individual tokens.
|
||||
if (!highlightedAsRegex) {
|
||||
int temp = zzStartRead + 1;
|
||||
addToken(zzStartRead, zzStartRead, Token.OPERATOR);
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos = temp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Separators. */
|
||||
{JS_Separator} { addToken(Token.SEPARATOR); }
|
||||
{JS_Separator2} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
/* Operators. */
|
||||
[\+]?"="{Whitespace}*"<" {
|
||||
int start = zzStartRead;
|
||||
int operatorLen = yycharat(0)=='+' ? 2 : 1;
|
||||
int yylen = yylength(); // Cache before first addToken() invalidates it
|
||||
//System.out.println("'" + yytext() + "': " + yylength() + ", " + (operatorLen+1));
|
||||
addToken(zzStartRead,zzStartRead+operatorLen-1, Token.OPERATOR);
|
||||
if (yylen>operatorLen+1) {
|
||||
//System.out.println((start+operatorLen) + ", " + (zzMarkedPos-2));
|
||||
addToken(start+operatorLen,zzMarkedPos-2, Token.WHITESPACE);
|
||||
}
|
||||
zzStartRead = zzCurrentPos = zzMarkedPos = zzMarkedPos - 1;
|
||||
if (isE4xSupported()) {
|
||||
// Scanning will continue with "<" as markup tag start
|
||||
yybegin(E4X, LANG_INDEX_E4X);
|
||||
}
|
||||
// Found e4x (or syntax error) but option not enabled;
|
||||
// Scanning will continue at "<" as operator
|
||||
}
|
||||
{JS_Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
/* Numbers */
|
||||
{JS_IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{JS_HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{JS_FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{JS_ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{JS_ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters and flag them as bad. */
|
||||
. { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
<JS_STRING> {
|
||||
[^\n\\\"]+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_STRING_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_STRING_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\" { int type = validJSString ? Token.LITERAL_STRING_DOUBLE_QUOTE : Token.ERROR_STRING_DOUBLE; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_CHAR> {
|
||||
[^\n\\\']+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
\\ { /* Line ending in '\' => continue to next line. */
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_CHAR);
|
||||
addEndToken(INTERNAL_IN_JS_CHAR_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_CHAR);
|
||||
addEndToken(INTERNAL_IN_JS_CHAR_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\' { int type = validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.ERROR_CHAR); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_TEMPLATE_LITERAL> {
|
||||
[^\n\\\$\`]+ {}
|
||||
\\x{HexDigit}{2} {}
|
||||
\\x { /* Invalid latin-1 character \xXX */ validJSString = false; }
|
||||
\\u{HexDigit}{4} {}
|
||||
\\u { /* Invalid Unicode character \\uXXXX */ validJSString = false; }
|
||||
\\. { /* Skip all escaped chars. */ }
|
||||
|
||||
{JS_TemplateLiteralExprStart} {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_BACKQUOTE);
|
||||
start = zzMarkedPos-2;
|
||||
if (varDepths==null) {
|
||||
varDepths = new Stack<Boolean>();
|
||||
}
|
||||
else {
|
||||
varDepths.clear();
|
||||
}
|
||||
varDepths.push(Boolean.TRUE);
|
||||
yybegin(JS_TEMPLATE_LITERAL_EXPR);
|
||||
}
|
||||
"$" { /* Skip valid '$' that is not part of template literal expression start */ }
|
||||
|
||||
\` { int type = validJSString ? Token.LITERAL_BACKQUOTE : Token.ERROR_STRING_DOUBLE; addToken(start,zzStartRead, type); yybegin(YYINITIAL); }
|
||||
|
||||
/* Line ending in '\' => continue to next line, though not necessary in template strings. */
|
||||
\\ {
|
||||
if (validJSString) {
|
||||
addToken(start,zzStartRead, Token.LITERAL_BACKQUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
\n |
|
||||
<<EOF>> {
|
||||
if (validJSString) {
|
||||
addToken(start, zzStartRead - 1, Token.LITERAL_BACKQUOTE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_VALID);
|
||||
}
|
||||
else {
|
||||
addToken(start,zzStartRead - 1, Token.ERROR_STRING_DOUBLE);
|
||||
addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID);
|
||||
}
|
||||
return firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
<JS_TEMPLATE_LITERAL_EXPR> {
|
||||
[^\}\$\n]+ {}
|
||||
"}" {
|
||||
if (!varDepths.empty()) {
|
||||
varDepths.pop();
|
||||
if (varDepths.empty()) {
|
||||
addToken(start,zzStartRead, Token.VARIABLE);
|
||||
start = zzMarkedPos;
|
||||
yybegin(JS_TEMPLATE_LITERAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
{JS_TemplateLiteralExprStart} { varDepths.push(Boolean.TRUE); }
|
||||
"$" {}
|
||||
\n |
|
||||
<<EOF>> {
|
||||
// TODO: This isn't right. The expression and its depth should continue to the next line.
|
||||
addToken(start,zzStartRead-1, Token.VARIABLE); addEndToken(INTERNAL_IN_JS_TEMPLATE_LITERAL_INVALID); return firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
<JS_MLC> {
|
||||
// JavaScript MLC's. This state is essentially Java's MLC state.
|
||||
[^hwf\n\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
{JS_MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE); }
|
||||
\* {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addEndToken(INTERNAL_IN_JS_MLC); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_DOCCOMMENT> {
|
||||
[^hwf\@\{\n\<\*]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_DOCUMENTATION); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
|
||||
"@"{JS_BlockTag} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_KEYWORD); start = zzMarkedPos; }
|
||||
"@" {}
|
||||
"{@"{JS_InlineTag}[^\}]*"}" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_KEYWORD); start = zzMarkedPos; }
|
||||
"{" {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addEndToken(INTERNAL_IN_JS_COMMENT_DOCUMENTATION); return firstToken; }
|
||||
"<"[/]?({Letter}[^\>]*)?">" { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_DOCUMENTATION); addToken(temp,zzMarkedPos-1, Token.COMMENT_MARKUP); start = zzMarkedPos; }
|
||||
\< {}
|
||||
{JS_MLCEnd} { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_DOCUMENTATION); }
|
||||
\* {}
|
||||
<<EOF>> { yybegin(YYINITIAL); addToken(start,zzEndRead, Token.COMMENT_DOCUMENTATION); addEndToken(INTERNAL_IN_JS_COMMENT_DOCUMENTATION); return firstToken; }
|
||||
}
|
||||
|
||||
<JS_EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X> {
|
||||
"<!--" { start = zzStartRead; e4x_prevState = zzLexicalState; yybegin(E4X_COMMENT); }
|
||||
{e4x_CDataBegin} { addToken(Token.MARKUP_CDATA_DELIMITER); start = zzMarkedPos; yybegin(E4X_CDATA); }
|
||||
"<!" { start = zzMarkedPos-2; e4x_inInternalDtd = false; yybegin(E4X_DTD); }
|
||||
"<?" { start = zzMarkedPos-2; yybegin(E4X_PI); }
|
||||
"<"{e4x_TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-1), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(E4X_INTAG);
|
||||
}
|
||||
"</"{e4x_TagName} {
|
||||
int count = yylength();
|
||||
addToken(zzStartRead,zzStartRead+1, Token.MARKUP_TAG_DELIMITER);
|
||||
addToken(zzMarkedPos-(count-2), zzMarkedPos-1, Token.MARKUP_TAG_NAME);
|
||||
yybegin(E4X_INTAG);
|
||||
}
|
||||
"<" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(E4X_INTAG); }
|
||||
"</" { addToken(Token.MARKUP_TAG_DELIMITER); yybegin(E4X_INTAG); }
|
||||
{e4x_Identifier} { addToken(Token.IDENTIFIER); }
|
||||
{e4x_EndXml} { yybegin(YYINITIAL, LANG_INDEX_DEFAULT); addToken(Token.IDENTIFIER); }
|
||||
{e4x_EntityReference} { addToken(Token.MARKUP_ENTITY_REFERENCE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addEndToken(INTERNAL_E4X); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_COMMENT> {
|
||||
[^hwf\n\-]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addHyperlinkToken(temp,zzMarkedPos-1, Token.MARKUP_COMMENT); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
"-->" { int temp = zzMarkedPos; addToken(start,zzStartRead+2, Token.MARKUP_COMMENT); start = temp; yybegin(e4x_prevState); }
|
||||
"-" {}
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_COMMENT); addEndToken(INTERNAL_IN_E4X_COMMENT - e4x_prevState); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_PI> {
|
||||
[^\n\?]+ {}
|
||||
"?>" { yybegin(E4X); addToken(start,zzStartRead+1, Token.MARKUP_PROCESSING_INSTRUCTION); }
|
||||
"?" {}
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_PROCESSING_INSTRUCTION); addEndToken(INTERNAL_E4X_MARKUP_PROCESSING_INSTRUCTION); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_DTD> {
|
||||
[^\n\[\]<>]+ {}
|
||||
"<!--" { int temp = zzStartRead; addToken(start,zzStartRead-1, Token.MARKUP_DTD); start = temp; e4x_prevState = zzLexicalState; yybegin(E4X_COMMENT); }
|
||||
"<" {}
|
||||
"[" { e4x_inInternalDtd = true; }
|
||||
"]" { e4x_inInternalDtd = false; }
|
||||
">" { if (!e4x_inInternalDtd) { yybegin(E4X); addToken(start,zzStartRead, Token.MARKUP_DTD); } }
|
||||
{LineTerminator} |
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_DTD); addEndToken(e4x_inInternalDtd ? INTERNAL_E4X_DTD_INTERNAL : INTERNAL_E4X_DTD); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_INTAG> {
|
||||
{e4x_InTagIdentifier} { addToken(Token.MARKUP_TAG_ATTRIBUTE); }
|
||||
{Whitespace} { addToken(Token.WHITESPACE); }
|
||||
"=" { addToken(Token.OPERATOR); }
|
||||
"/" { addToken(Token.MARKUP_TAG_DELIMITER); /* Not valid but we'll still accept it */ }
|
||||
"/>" { yybegin(E4X); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
">" { yybegin(E4X); addToken(Token.MARKUP_TAG_DELIMITER); }
|
||||
[\"] { start = zzMarkedPos-1; yybegin(E4X_INATTR_DOUBLE); }
|
||||
[\'] { start = zzMarkedPos-1; yybegin(E4X_INATTR_SINGLE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, INTERNAL_E4X_INTAG); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_INATTR_DOUBLE> {
|
||||
[^\"]* {}
|
||||
[\"] { yybegin(E4X_INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_E4X_ATTR_DOUBLE); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_INATTR_SINGLE> {
|
||||
[^\']* {}
|
||||
[\'] { yybegin(E4X_INTAG); addToken(start,zzStartRead, Token.MARKUP_TAG_ATTRIBUTE_VALUE); }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_TAG_ATTRIBUTE_VALUE); addEndToken(INTERNAL_E4X_ATTR_SINGLE); return firstToken; }
|
||||
}
|
||||
|
||||
<E4X_CDATA> {
|
||||
[^\]]+ {}
|
||||
{e4x_CDataEnd} { int temp=zzStartRead; yybegin(E4X); addToken(start,zzStartRead-1, Token.MARKUP_CDATA); addToken(temp,zzMarkedPos-1, Token.MARKUP_CDATA_DELIMITER); }
|
||||
"]" {}
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.MARKUP_CDATA); addEndToken(INTERNAL_E4X_MARKUP_CDATA); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,460 +0,0 @@
|
||||
/*
|
||||
* 03/24/2013
|
||||
*
|
||||
* VisualBasicTokenMaker.java - Scanner for Visual Basic
|
||||
*
|
||||
* This library is distributed under a modified BSD license. See the included
|
||||
* RSyntaxTextArea.License.txt file for details.
|
||||
*/
|
||||
package org.fife.ui.rsyntaxtextarea.modes;
|
||||
|
||||
import java.io.*;
|
||||
import javax.swing.text.Segment;
|
||||
|
||||
import org.fife.ui.rsyntaxtextarea.*;
|
||||
|
||||
|
||||
/**
|
||||
* Scanner for Visual Basic.
|
||||
*
|
||||
* This implementation was created using
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
|
||||
* was modified for performance. Memory allocation needs to be almost
|
||||
* completely removed to be competitive with the handwritten lexers (subclasses
|
||||
* of <code>AbstractTokenMaker</code>, so this class has been modified so that
|
||||
* Strings are never allocated (via yytext()), and the scanner never has to
|
||||
* worry about refilling its buffer (needlessly copying chars around).
|
||||
* We can achieve this because RText always scans exactly 1 line of tokens at a
|
||||
* time, and hands the scanner this line as an array of characters (a Segment
|
||||
* really). Since tokens contain pointers to char arrays instead of Strings
|
||||
* holding their contents, there is no need for allocating new memory for
|
||||
* Strings.<p>
|
||||
*
|
||||
* The actual algorithm generated for scanning has, of course, not been
|
||||
* modified.<p>
|
||||
*
|
||||
* If you wish to regenerate this file yourself, keep in mind the following:
|
||||
* <ul>
|
||||
* <li>The generated <code>VisualBasicTokenMaker.java</code> file will contain two
|
||||
* definitions of both <code>zzRefill</code> and <code>yyreset</code>.
|
||||
* You should hand-delete the second of each definition (the ones
|
||||
* generated by the lexer), as these generated methods modify the input
|
||||
* buffer, which we'll never have to do.</li>
|
||||
* <li>You should also change the declaration/definition of zzBuffer to NOT
|
||||
* be initialized. This is a needless memory allocation for us since we
|
||||
* will be pointing the array somewhere else anyway.</li>
|
||||
* <li>You should NOT call <code>yylex()</code> on the generated scanner
|
||||
* directly; rather, you should use <code>getTokenList</code> as you would
|
||||
* with any other <code>TokenMaker</code> instance.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Robert Futrell
|
||||
* @version 1.0
|
||||
*/
|
||||
%%
|
||||
|
||||
%public
|
||||
%class VisualBasicTokenMaker
|
||||
%extends AbstractJFlexTokenMaker
|
||||
%unicode
|
||||
%ignorecase
|
||||
%type org.fife.ui.rsyntaxtextarea.Token
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. This must be here because JFlex does not generate a
|
||||
* no-parameter constructor.
|
||||
*/
|
||||
public VisualBasicTokenMaker() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addToken(int, int, int)
|
||||
*/
|
||||
private void addHyperlinkToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
*/
|
||||
private void addToken(int tokenType) {
|
||||
addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param tokenType The token's type.
|
||||
* @see #addHyperlinkToken(int, int, int)
|
||||
*/
|
||||
private void addToken(int start, int end, int tokenType) {
|
||||
int so = start + offsetShift;
|
||||
addToken(zzBuffer, start,end, tokenType, so, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the token specified to the current linked list of tokens.
|
||||
*
|
||||
* @param array The character array.
|
||||
* @param start The starting offset in the array.
|
||||
* @param end The ending offset in the array.
|
||||
* @param tokenType The token's type.
|
||||
* @param startOffset The offset in the document at which this token
|
||||
* occurs.
|
||||
* @param hyperlink Whether this token is a hyperlink.
|
||||
*/
|
||||
@Override
|
||||
public void addToken(char[] array, int start, int end, int tokenType,
|
||||
int startOffset, boolean hyperlink) {
|
||||
super.addToken(array, start,end, tokenType, startOffset, hyperlink);
|
||||
zzStartRead = zzMarkedPos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String[] getLineCommentStartAndEnd(int languageIndex) {
|
||||
return new String[] { "'", null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first token in the linked list of tokens generated
|
||||
* from <code>text</code>. This method must be implemented by
|
||||
* subclasses so they can correctly implement syntax highlighting.
|
||||
*
|
||||
* @param text The text from which to get tokens.
|
||||
* @param initialTokenType The token type we should start with.
|
||||
* @param startOffset The offset into the document at which
|
||||
* <code>text</code> starts.
|
||||
* @return The first <code>Token</code> in a linked list representing
|
||||
* the syntax highlighted text.
|
||||
*/
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
|
||||
resetTokenList();
|
||||
this.offsetShift = -text.offset + startOffset;
|
||||
|
||||
// Start off in the proper state.
|
||||
int state = YYINITIAL;
|
||||
|
||||
s = text;
|
||||
try {
|
||||
yyreset(zzReader);
|
||||
yybegin(state);
|
||||
return yylex();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
return new TokenImpl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refills the input buffer.
|
||||
*
|
||||
* @return <code>true</code> if EOF was reached, otherwise
|
||||
* <code>false</code>.
|
||||
*/
|
||||
private boolean zzRefill() {
|
||||
return zzCurrentPos>=s.offset+s.count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the scanner to read from a new input stream.
|
||||
* Does not close the old reader.
|
||||
*
|
||||
* All internal variables are reset, the old input stream
|
||||
* <b>cannot</b> be reused (internal buffer is discarded and lost).
|
||||
* Lexical state is set to <tt>YY_INITIAL</tt>.
|
||||
*
|
||||
* @param reader the new input stream
|
||||
*/
|
||||
public final void yyreset(java.io.Reader reader) {
|
||||
// 's' has been updated.
|
||||
zzBuffer = s.array;
|
||||
/*
|
||||
* We replaced the line below with the two below it because zzRefill
|
||||
* no longer "refills" the buffer (since the way we do it, it's always
|
||||
* "full" the first time through, since it points to the segment's
|
||||
* array). So, we assign zzEndRead here.
|
||||
*/
|
||||
//zzStartRead = zzEndRead = s.offset;
|
||||
zzStartRead = s.offset;
|
||||
zzEndRead = zzStartRead + s.count - 1;
|
||||
zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
|
||||
zzLexicalState = YYINITIAL;
|
||||
zzReader = reader;
|
||||
zzAtBOL = true;
|
||||
zzAtEOF = false;
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
Letter = [A-Za-z]
|
||||
LetterOrUnderscore = ({Letter}|"_")
|
||||
NonzeroDigit = [1-9]
|
||||
Digit = ("0"|{NonzeroDigit})
|
||||
HexDigit = ({Digit}|[A-Fa-f])
|
||||
NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
|
||||
IdentifierStart = ({LetterOrUnderscore}|"$")
|
||||
IdentifierPart = ({IdentifierStart}|{Digit})
|
||||
|
||||
LineTerminator = (\n)
|
||||
WhiteSpace = ([ \t\f])
|
||||
|
||||
UnclosedStringLiteral = ([\"][^\"]*)
|
||||
StringLiteral = ({UnclosedStringLiteral}[\"])
|
||||
|
||||
LineCommentBegin = "'"
|
||||
|
||||
NumTypeSuffix = (([DRI\&SF]|"UI"|"UL"|"US")?)
|
||||
IntegerLiteral = ({Digit}+{NumTypeSuffix})
|
||||
HexLiteral = ("&h"{HexDigit}+{NumTypeSuffix})
|
||||
FloatHelper = ([eE][+-]?{Digit}+{NumTypeSuffix})
|
||||
FloatLiteral1 = ({Digit}+"."({NumTypeSuffix}|{FloatHelper}|{Digit}+({NumTypeSuffix}|{FloatHelper})))
|
||||
FloatLiteral2 = ("."{Digit}+({NumTypeSuffix}|{FloatHelper}))
|
||||
FloatLiteral3 = ({Digit}+({NumTypeSuffix}|{FloatHelper}))
|
||||
FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3})
|
||||
ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
|
||||
BooleanLiteral = ("true"|"false")
|
||||
|
||||
Separator = ([\(\)])
|
||||
Separator2 = ([\;,.])
|
||||
|
||||
Operator = ("&"|"&="|"*"|"*="|"+"|"+="|"="|"-"|"-="|"<<"|"<<="|">>"|">>="|"/"|"/="|"\\"|"\\="|"^"|"^=")
|
||||
|
||||
Identifier = ({IdentifierStart}{IdentifierPart}*)
|
||||
ErrorIdentifier = ({NonSeparator}+)
|
||||
|
||||
URLGenDelim = ([:\/\?#\[\]@])
|
||||
URLSubDelim = ([\!\$&'\(\)\*\+,;=])
|
||||
URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
|
||||
URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
|
||||
URLCharacters = ({URLCharacter}*)
|
||||
URLEndCharacter = ([\/\$]|{Letter}|{Digit})
|
||||
URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
|
||||
|
||||
%state EOL_COMMENT
|
||||
|
||||
%%
|
||||
|
||||
<YYINITIAL> {
|
||||
|
||||
/* Keywords */
|
||||
"AddHandler" |
|
||||
"AddressOf" |
|
||||
"Alias" |
|
||||
"And" |
|
||||
"AndAlso" |
|
||||
"As" |
|
||||
"ByRef" |
|
||||
"ByVal" |
|
||||
"Call" |
|
||||
"Case" |
|
||||
"Catch" |
|
||||
"CBool" |
|
||||
"CByte" |
|
||||
"CChar" |
|
||||
"CDate" |
|
||||
"CDbl" |
|
||||
"CDec" |
|
||||
"CInt" |
|
||||
"Class" |
|
||||
"CLng" |
|
||||
"CObj" |
|
||||
"Const" |
|
||||
"Continue" |
|
||||
"CSByte" |
|
||||
"CShort" |
|
||||
"CSng" |
|
||||
"CStr" |
|
||||
"CType" |
|
||||
"CUInt" |
|
||||
"CULng" |
|
||||
"CUShort" |
|
||||
"Declare" |
|
||||
"Default" |
|
||||
"Delegate" |
|
||||
"Dim" |
|
||||
"DirectCast" |
|
||||
"Do" |
|
||||
"Each" |
|
||||
"Else" |
|
||||
"ElseIf" |
|
||||
"End" |
|
||||
"EndIf" |
|
||||
"Enum" |
|
||||
"Erase" |
|
||||
"Error" |
|
||||
"Event" |
|
||||
"Exit" |
|
||||
"Finally" |
|
||||
"For" |
|
||||
"Friend" |
|
||||
"Function" |
|
||||
"Get" |
|
||||
"GetType" |
|
||||
"GetXMLNamespace" |
|
||||
"Global" |
|
||||
"GoSub" |
|
||||
"GoTo" |
|
||||
"Handles" |
|
||||
"If" |
|
||||
"If" |
|
||||
"Implements" |
|
||||
"Imports" |
|
||||
"In" |
|
||||
"Inherits" |
|
||||
"Interface" |
|
||||
"Is" |
|
||||
"IsNot" |
|
||||
"Let" |
|
||||
"Lib" |
|
||||
"Like" |
|
||||
"Loop" |
|
||||
"Me" |
|
||||
"Mod" |
|
||||
"Module" |
|
||||
"Module Statement" |
|
||||
"MustInherit" |
|
||||
"MustOverride" |
|
||||
"MyBase" |
|
||||
"MyClass" |
|
||||
"Namespace" |
|
||||
"Narrowing" |
|
||||
"New" |
|
||||
"New" |
|
||||
"Next" |
|
||||
"Not" |
|
||||
"Nothing" |
|
||||
"NotInheritable" |
|
||||
"NotOverridable" |
|
||||
"Of" |
|
||||
"On" |
|
||||
"Operator" |
|
||||
"Option" |
|
||||
"Optional" |
|
||||
"Or" |
|
||||
"OrElse" |
|
||||
"Out" |
|
||||
"Overloads" |
|
||||
"Overridable" |
|
||||
"Overrides" |
|
||||
"ParamArray" |
|
||||
"Partial" |
|
||||
"Private" |
|
||||
"Property" |
|
||||
"Protected" |
|
||||
"Public" |
|
||||
"RaiseEvent" |
|
||||
"ReadOnly" |
|
||||
"ReDim" |
|
||||
"REM" |
|
||||
"RemoveHandler" |
|
||||
"Resume" |
|
||||
"Select" |
|
||||
"Set" |
|
||||
"Shadows" |
|
||||
"Shared" |
|
||||
"Static" |
|
||||
"Step" |
|
||||
"Stop" |
|
||||
"Structure" |
|
||||
"Sub" |
|
||||
"SyncLock" |
|
||||
"Then" |
|
||||
"Throw" |
|
||||
"To" |
|
||||
"Try" |
|
||||
"TryCast" |
|
||||
"TypeOf" |
|
||||
"Using" |
|
||||
"Variant" |
|
||||
"Wend" |
|
||||
"When" |
|
||||
"While" |
|
||||
"Widening" |
|
||||
"With" |
|
||||
"WithEvents" |
|
||||
"WriteOnly" |
|
||||
"Xor" { addToken(Token.RESERVED_WORD); }
|
||||
"Return" { addToken(Token.RESERVED_WORD_2); }
|
||||
|
||||
/* Data types. */
|
||||
"Boolean" |
|
||||
"Byte" |
|
||||
"Char" |
|
||||
"Date" |
|
||||
"Decimal" |
|
||||
"Double" |
|
||||
"Integer" |
|
||||
"Long" |
|
||||
"Object" |
|
||||
"SByte" |
|
||||
"Short" |
|
||||
"Single" |
|
||||
"String" |
|
||||
"UInteger" |
|
||||
"ULong" |
|
||||
"UShort" { addToken(Token.DATA_TYPE); }
|
||||
|
||||
{BooleanLiteral} { addToken(Token.LITERAL_BOOLEAN); }
|
||||
|
||||
{LineTerminator} { addNullToken(); return firstToken; }
|
||||
|
||||
{Identifier} { addToken(Token.IDENTIFIER); }
|
||||
|
||||
{WhiteSpace}+ { addToken(Token.WHITESPACE); }
|
||||
|
||||
{StringLiteral} { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE); }
|
||||
{UnclosedStringLiteral} { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken; }
|
||||
|
||||
{LineCommentBegin} { start = zzMarkedPos-1; yybegin(EOL_COMMENT); }
|
||||
|
||||
{Separator} { addToken(Token.SEPARATOR); }
|
||||
{Separator2} { addToken(Token.IDENTIFIER); }
|
||||
{Operator} { addToken(Token.OPERATOR); }
|
||||
|
||||
{IntegerLiteral} { addToken(Token.LITERAL_NUMBER_DECIMAL_INT); }
|
||||
{HexLiteral} { addToken(Token.LITERAL_NUMBER_HEXADECIMAL); }
|
||||
{FloatLiteral} { addToken(Token.LITERAL_NUMBER_FLOAT); }
|
||||
{ErrorNumberFormat} { addToken(Token.ERROR_NUMBER_FORMAT); }
|
||||
|
||||
{ErrorIdentifier} { addToken(Token.ERROR_IDENTIFIER); }
|
||||
|
||||
/* Ended with a line not in a string or comment. */
|
||||
<<EOF>> { addNullToken(); return firstToken; }
|
||||
|
||||
/* Catch any other (unhandled) characters. */
|
||||
. { addToken(Token.IDENTIFIER); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
<EOL_COMMENT> {
|
||||
[^hwf\n]+ {}
|
||||
{URL} { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos; }
|
||||
[hwf] {}
|
||||
\n { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
<<EOF>> { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken; }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Loaded 100 of 105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user