porting in progress
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..2306fc9
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="Prettify" default="default" basedir=".">
+ <description>Builds, tests, and runs the project Prettify.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project properties
+ -post-init: called after initialization of project properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single JUnit test
+ -post-compile-test-single: called after javac compilation of single JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like this:
+
+ <target name="run" depends="Prettify-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only on
+ the compile target as the regular run target does. Again, for a list of available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>
diff --git a/manifest.mf b/manifest.mf
new file mode 100644
index 0000000..d12ceec
--- /dev/null
+++ b/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT:
+
diff --git a/nbproject/project.properties b/nbproject/project.properties
index f4a767d..ac5d4e0 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -1,9 +1,9 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
-annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=Java Prettify
+application.vendor=Chan Wai Shing
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@@ -24,24 +24,28 @@
dist.dir=dist
dist.jar=${dist.dir}/Prettify.jar
dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
excludes=
includes=**
-jar.compress=false
+jar.archive.disabled=${jnlp.enabled}
+jar.compress=true
+jar.index=${jnlp.enabled}
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
-javac.deprecation=false
+javac.deprecation=true
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
- ${build.classes.dir}
+ ${build.classes.dir}:\
+ ${libs.junit_4.classpath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
-javadoc.author=false
+javadoc.author=true
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
@@ -49,8 +53,17 @@
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
+javadoc.version=true
+javadoc.windowtitle=Java Prettify
+jnlp.codebase.type=no.codebase
+jnlp.descriptor=application
+jnlp.enabled=false
+jnlp.mixed.code=default
+jnlp.offline-allowed=false
+jnlp.signed=false
+jnlp.signing=
+jnlp.signing.alias=
+jnlp.signing.keystore=
main.class=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
diff --git a/src/prettify/CombinePrefixPattern.java b/src/prettify/CombinePrefixPattern.java
index d9348d3..e75500b 100644
--- a/src/prettify/CombinePrefixPattern.java
+++ b/src/prettify/CombinePrefixPattern.java
@@ -46,7 +46,7 @@
Pattern regex = regexs.get(i);
if ((regex.flags() & Pattern.CASE_INSENSITIVE) != 0) {
ignoreCase = true;
- } else if (regex.pattern().replaceAll("(?i)\\\\u[0-9a-f]{4}|\\\\x[0-9a-f]{2}|\\\\[^ux]", "").matches("(?i)[a-z]")) {
+ } else if (Util.test(Pattern.compile("[a-z]", Pattern.CASE_INSENSITIVE), regex.pattern().replaceAll("\\\\[Uu][0-9A-Fa-f]{4}|\\\\[Xx][0-9A-Fa-f]{2}|\\\\[^UuXx]", ""))) {
needToFoldCase = true;
ignoreCase = false;
break;
@@ -121,7 +121,7 @@
for (int i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
String p = charsetParts[i];
- if (p.matches("(?i)\\\\[bdsw]")) { // Don't muck with named groups.
+ if (Util.test(Pattern.compile("\\\\[bdsw]", Pattern.CASE_INSENSITIVE), p)) { // Don't muck with named groups.
out.add(p);
} else {
int start = decodeEscape(p);
@@ -158,26 +158,26 @@
}
});
List<List<Integer>> consolidatedRanges = new ArrayList<List<Integer>>();
- Map<Integer, Integer> lastRange = new HashMap<Integer, Integer>();
+// List<Integer> lastRange = Arrays.asList(new Integer[]{0, 0});
+ List<Integer> lastRange = new ArrayList<Integer>(Arrays.asList(new Integer[]{0, 0}));
for (int i = 0; i < ranges.size(); ++i) {
List<Integer> range = ranges.get(i);
if (lastRange.get(1) != null && range.get(0) <= lastRange.get(1) + 1) {
- lastRange.put(1, Math.max(lastRange.get(1), range.get(1)));
+ lastRange.set(1, Math.max(lastRange.get(1), range.get(1)));
} else {
- consolidatedRanges.add(range);
- lastRange.put(0, range.get(0));
- lastRange.put(1, range.get(1));
+ // reference of lastRange is added
+ consolidatedRanges.add(lastRange = range);
}
}
for (int i = 0; i < consolidatedRanges.size(); ++i) {
List<Integer> range = consolidatedRanges.get(i);
- out.add(encodeEscape((int) range.get(0)));
+ out.add(encodeEscape(range.get(0)));
if (range.get(1) > range.get(0)) {
if (range.get(1) + 1 > range.get(0)) {
out.add("-");
}
- out.add(encodeEscape((int) range.get(1)));
+ out.add(encodeEscape(range.get(1)));
}
}
out.add("]");
@@ -267,16 +267,17 @@
if ((regex.flags() & Pattern.CASE_INSENSITIVE) != 0 && needToFoldCase) {
for (int i = 0; i < n; ++i) {
String p = parts[i];
- char ch0 = p.charAt(0);
+ char ch0 = p.length() > 0 ? p.charAt(0) : 0;
if (p.length() >= 2 && ch0 == '[') {
parts[i] = caseFoldCharset(p);
- } else if (ch0 == '\\') {
+ } else if (ch0 != '\\') {
// TODO: handle letters in numeric escapes.
StringBuffer sb = new StringBuffer();
Matcher _matcher = Pattern.compile("[a-zA-Z]").matcher(p);
while (_matcher.find()) {
int cc = _matcher.group(0).codePointAt(0);
- _matcher.appendReplacement(sb, "[" + Character.toString((char) (cc & ~32)) + Character.toString((char) (cc | 32)) + "]");
+ _matcher.appendReplacement(sb, "");
+ sb.append("[").append(Character.toString((char) (cc & ~32))).append(Character.toString((char) (cc | 32))).append("]");
}
_matcher.appendTail(sb);
parts[i] = sb.toString();
diff --git a/src/prettify/Prettify.java b/src/prettify/Prettify.java
index 5e50f7a..cf7ddfb 100644
--- a/src/prettify/Prettify.java
+++ b/src/prettify/Prettify.java
@@ -13,12 +13,12 @@
// limitations under the License.
package prettify;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
@@ -121,7 +121,7 @@
/**
* token style for a type
*/
- public static final String PR_TYPE = "';";
+ public static final String PR_TYPE = "typ";
/**
* token style for a literal value. e.g. 1, null, true.
*/
@@ -212,8 +212,10 @@
shortcutStylePatterns = new ArrayList<List<Object>>();
fallthroughStylePatterns = new ArrayList<List<Object>>();
shortcutStylePatterns.add(Arrays.asList(new Object[]{PR_PLAIN, Pattern.compile("^[\\s]+"), null, " \t\r\n"}));
- shortcutStylePatterns.add(Arrays.asList(new Object[]{PR_ATTRIB_VALUE, Pattern.compile("^(?:\\\"[^\\\"]*\\\"?|\\'[^\\']*\\'?)"), null, " \t\r\n"}));
- fallthroughStylePatterns.add(Arrays.asList(new Object[]{"lang-uq.val", Pattern.compile("^^<\\/?[a-z](?:[\\w.:-]*\\w)?|\\/?>$", Pattern.CASE_INSENSITIVE)}));
+ shortcutStylePatterns.add(Arrays.asList(new Object[]{PR_ATTRIB_VALUE, Pattern.compile("^(?:\\\"[^\\\"]*\\\"?|\\'[^\\']*\\'?)"), null, "\'"}));
+ fallthroughStylePatterns.add(Arrays.asList(new Object[]{PR_TAG, Pattern.compile("^^<\\/?[a-z](?:[\\w.:-]*\\w)?|\\/?>$", Pattern.CASE_INSENSITIVE)}));
+ fallthroughStylePatterns.add(Arrays.asList(new Object[]{PR_ATTRIB_NAME, Pattern.compile("^(?!style[\\s=]|on)[a-z](?:[\\w:-]*\\w)?", Pattern.CASE_INSENSITIVE)}));
+ fallthroughStylePatterns.add(Arrays.asList(new Object[]{"lang-uq.val", Pattern.compile("^=\\s*([^>\\'\\\"\\s]*(?:[^>\\'\\\"\\s\\/]|\\/(?=\\s)))", Pattern.CASE_INSENSITIVE)}));
fallthroughStylePatterns.add(Arrays.asList(new Object[]{PR_PUNCTUATION, Pattern.compile("^[=<>\\/]+")}));
fallthroughStylePatterns.add(Arrays.asList(new Object[]{"lang-js", Pattern.compile("^on\\w+\\s*=\\s*\\\"([^\\\"]+)\\\"", Pattern.CASE_INSENSITIVE)}));
fallthroughStylePatterns.add(Arrays.asList(new Object[]{"lang-js", Pattern.compile("^on\\w+\\s*=\\s*\\'([^\\']+)\\'", Pattern.CASE_INSENSITIVE)}));
@@ -379,7 +381,7 @@
Map<String, Object> regexKeys = new HashMap<String, Object>();
for (int i = 0, n = allPatterns.size(); i < n; ++i) {
List<Object> patternParts = allPatterns.get(i);
- String shortcutChars = patternParts.size() > 4 ? (String) patternParts.get(3) : null;
+ String shortcutChars = patternParts.size() > 3 ? (String) patternParts.get(3) : null;
if (shortcutChars != null) {
for (int c = shortcutChars.length(); --c >= 0;) {
shortcuts.put(shortcutChars.charAt(c), patternParts);
@@ -495,7 +497,25 @@
}
}
- job.setDecorations(decorations);
+ List<Object> newDecorations = new ArrayList<Object>();
+
+ // use TreeMap to remove entrys with same pos
+ Map<Integer, String> posToStyleMap = new TreeMap<Integer, String>();
+ for (int i = 0, iEnd = decorations.size(); i < iEnd;) {
+ posToStyleMap.put((Integer) decorations.get(i++), (String) decorations.get(i++));
+ }
+ // remove adjacent style
+ String previousStyle = null;
+ for (Integer _pos : posToStyleMap.keySet()) {
+ if (previousStyle != null && previousStyle.equals(posToStyleMap.get(_pos))) {
+ continue;
+ }
+ newDecorations.add(_pos);
+ newDecorations.add(posToStyleMap.get(_pos));
+ previousStyle = posToStyleMap.get(_pos);
+ }
+
+ job.setDecorations(newDecorations);
}
}
@@ -684,20 +704,10 @@
if (!(extension != null && langHandlerRegistry.get(extension) != null)) {
// Treat it as markup if the first non whitespace character is a < and
// the last non-whitespace character is a >.
- extension = source.matches("^\\s&<")
+ extension = Util.test(Pattern.compile("^\\s&<"), source)
? "default-markup"
: "default-code";
}
return langHandlerRegistry.get(extension);
}
-
- public static void main(String[] args) throws IOException {
- Job job = new Job();
- job.setBasePos(0);
- job.setSourceCode(new String(Util.readResourceFile("/prettify/example.html")));
- Prettify prettify = new Prettify();
- prettify.langHandlerRegistry.get("html").decorate(job);
- List<Object> decorations = job.getDecorations();
- System.out.println(decorations);
- }
}
diff --git a/src/prettify/Util.java b/src/prettify/Util.java
index 3f53f93..d4afa9c 100644
--- a/src/prettify/Util.java
+++ b/src/prettify/Util.java
@@ -1,8 +1,5 @@
package prettify;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
@@ -13,43 +10,6 @@
*/
public class Util {
- /**
- * Read the resource file from the jar.
- * @param path the resource path
- * @return the content of the resource file in byte array
- * @throws IOException error occurred when reading the content from the file
- */
- public static byte[] readResourceFile(String path) throws IOException {
- if (path == null) {
- throw new NullPointerException("argument 'path' cannot be null");
- }
-
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- InputStream in = null;
- try {
- in = Util.class.getResourceAsStream(path);
- if (in == null) {
- throw new IOException("Resources not found: " + path);
- }
-
- int byteRead = 0;
- byte[] b = new byte[8096];
-
- while ((byteRead = in.read(b)) != -1) {
- bout.write(b, 0, byteRead);
- }
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException ex) {
- }
- }
- }
-
- return bout.toByteArray();
- }
-
public static String[] match(Pattern pattern, String string) {
List<String> matchesList = new ArrayList<String>();
@@ -61,6 +21,11 @@
return matchesList.toArray(new String[matchesList.size()]);
}
+ public static boolean test(Pattern pattern, String string) {
+ Matcher matcher = pattern.matcher(string);
+ return matcher.find();
+ }
+
public static String join(List<String> strings) {
return join(strings.toArray(new String[strings.size()]));
}
diff --git a/src/prettify/example.html b/src/prettify/example.html
deleted file mode 100644
index 1ef22ae..0000000
--- a/src/prettify/example.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<html>
-<head>
- <title> HTML Script Example </title>
- <style type="text/css">
- body {
- font-family: Helvetica, Geneva, Arial, sans-serif;
- font-size: 1em;
- margin: 4em 15em 4em 4em;
- }
- body.with_sponsor { margin-right: 410px; }
- a.external {
- background: url(../images/external.png) right 50% no-repeat;
- padding-right: 12px;
- }
- code, pre, .file-list {
- font-family: Consolas, Monaco, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
- }
- </style>
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-XXXXX-XX']);
- _gaq.push(['_trackPageview']);
-
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
-</head>
-<body>
-
-<div style="font-weight: bold"><?= str_replace("\n", "<br/>", $var) ?></div>
-<?php
- /***********************************
- ** Multiline block comments
- **********************************/
-
- $stringWithUrl = "http://alexgorbatchev.com";
- $stringWithUrl = 'http://alexgorbatchev.com';
-
- ob_start("parseOutputBuffer"); // Start Code Buffering
- session_start();
-?>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest.java b/test/prettify/PrettifyTest.java
new file mode 100644
index 0000000..8d4cf42
--- /dev/null
+++ b/test/prettify/PrettifyTest.java
@@ -0,0 +1,338 @@
+// Copyright (C) 2006 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package prettify;
+
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.ListIterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.ArrayList;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PrettifyTest {
+
+ protected final String packagePath = "test/" + this.getClass().getCanonicalName().replace('.', '/') + "/";
+
+ public PrettifyTest() {
+ }
+
+ protected static String getClassName() {
+ return new Object() {
+ }.getClass().getEnclosingClass().getName();
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ System.out.println("***** " + getClassName() + " *****");
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ System.out.println("******************************\r\n");
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ @Test
+ public void test() throws IOException {
+ System.out.println("+++++ test +++++");
+
+ Prettify prettify = new Prettify();
+ Job job;
+ String source;
+ List<Object> decorations, compare;
+
+ source = new String(readFile(new File(packagePath + "source/bash.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/bash.txt"))));
+ assertArrayEquals("bash", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/bash_lang.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension("sh", source).decorate(job);
+ decorations = removeNewLine(job.getDecorations(), source);
+ compare = readResult(new String(readFile(new File(packagePath + "result/bash_lang.txt"))), true);
+ assertArrayEquals("bash_lang", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/java.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/java.txt"))));
+ assertArrayEquals("java", decorations.toArray(), compare.toArray());
+
+
+ source = new String(readFile(new File(packagePath + "source/java_lang.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension("java", source).decorate(job);
+ decorations = removeNewLine(job.getDecorations(), source);
+ compare = readResult(new String(readFile(new File(packagePath + "result/java_lang.txt"))), true);
+ assertArrayEquals("java_lang", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/C.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/C.txt"))));
+ assertArrayEquals("C", decorations.toArray(), compare.toArray());
+
+
+ source = new String(readFile(new File(packagePath + "source/C_lang.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension("c", source).decorate(job);
+ decorations = removeNewLine(job.getDecorations(), source);
+ compare = readResult(new String(readFile(new File(packagePath + "result/C_lang.txt"))), true);
+ assertArrayEquals("C_lang", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/Cpp.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/Cpp.txt"))));
+ assertArrayEquals("Cpp", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/Cpp_lang.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension("cpp", source).decorate(job);
+ decorations = removeNewLine(job.getDecorations(), source);
+ compare = readResult(new String(readFile(new File(packagePath + "result/Cpp_lang.txt"))), true);
+ assertArrayEquals("Cpp_lang", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/javascript.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/javascript.txt"))));
+ assertArrayEquals("javascript", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/perl.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/perl.txt"))));
+ assertArrayEquals("perl", decorations.toArray(), compare.toArray());
+
+
+ source = new String(readFile(new File(packagePath + "source/python.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension(null, source).decorate(job);
+ decorations = job.getDecorations();
+ compare = readResult(new String(readFile(new File(packagePath + "result/python.txt"))));
+ assertArrayEquals("python", decorations.toArray(), compare.toArray());
+
+ source = new String(readFile(new File(packagePath + "source/python_lang.txt")));
+ job = new Job();
+ job.setBasePos(0);
+ job.setSourceCode(source);
+ prettify.langHandlerForExtension("py", source).decorate(job);
+ decorations = removeNewLine(job.getDecorations(), source);
+ compare = readResult(new String(readFile(new File(packagePath + "result/python_lang.txt"))), true);
+ assertArrayEquals("python_lang", decorations.toArray(), compare.toArray());
+
+ }
+
+ /**
+ * Read the whole file and return the content in byte array.
+ * @param file the file to read
+ * @return the content of the file in byte array
+ * @throws IOException error occurred when reading the content from the file
+ */
+ public static byte[] readFile(File file) throws IOException {
+ if (file == null) {
+ throw new NullPointerException("argument 'file' cannot be null");
+ }
+
+ long fileLength = file.length();
+ byte[] content = new byte[(int) fileLength];
+
+ FileInputStream fin = null;
+ try {
+ fin = new FileInputStream(file);
+
+ int byteRead = 0, cumulateByteRead = 0;
+ while ((byteRead = fin.read(content, cumulateByteRead, content.length - cumulateByteRead)) != -1) {
+ cumulateByteRead += byteRead;
+ if (cumulateByteRead >= fileLength) {
+ break;
+ }
+ }
+
+ if (cumulateByteRead != fileLength) {
+ throw new IOException("The total number of bytes read does not match the file size. Actual file size: " + fileLength + ", bytes read: " + cumulateByteRead + ", path: " + file.getAbsolutePath());
+ }
+ } finally {
+ if (fin != null) {
+ try {
+ fin.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+
+ return content;
+ }
+
+ public static List<Object> removeNewLine(List<Object> decorations, String source) {
+ StringBuffer sb = new StringBuffer();
+ Pattern pattern = Pattern.compile("\r\n");
+ Matcher matcher = pattern.matcher(source);
+ while (matcher.find()) {
+ matcher.appendReplacement(sb, "");
+ int posStart = sb.length();
+ ListIterator<Object> iterator = decorations.listIterator();
+ while (iterator.hasNext()) {
+ Integer pos = (Integer) iterator.next();
+ if (pos > posStart) {
+ iterator.set(pos - 2);
+ }
+ iterator.next();
+ }
+ }
+// matcher.appendTail(sb);
+
+ // use TreeMap to remove entrys with same pos
+ Map<Integer, Object> orderedMap = new TreeMap<Integer, Object>();
+ for (int i = 0, iEnd = decorations.size(); i < iEnd; i++) {
+ orderedMap.put((Integer) decorations.get(i), decorations.get(i + 1));
+ i++;
+ }
+ // remove adjacent style
+ List<Object> returnList = new ArrayList<Object>(orderedMap.size() + 1);
+ String previousStyle = null;
+ for (Integer _pos : orderedMap.keySet()) {
+ if (previousStyle != null && previousStyle.equals(orderedMap.get(_pos))) {
+ continue;
+ }
+ returnList.add(_pos);
+ returnList.add(orderedMap.get(_pos));
+ previousStyle = (String) orderedMap.get(_pos);
+ }
+
+ return returnList;
+ }
+
+ public static List<Object> readResult(String result) {
+ return readResult(result, false);
+ }
+
+ public static List<Object> readResult(String result, boolean removeNewLine) {
+ List<Object> returnList = new ArrayList<Object>();
+
+ int count = 0;
+
+ if (removeNewLine) {
+ while (true) {
+ StringBuffer sb = new StringBuffer();
+ result = result.replaceAll("[\r\n]", "");
+ Pattern pattern = Pattern.compile("(`[A-Z]{3})([^`]+?)`END\\1([^`]+?)`END", Pattern.MULTILINE | Pattern.DOTALL);
+ Matcher matcher = pattern.matcher(result);
+ boolean found = false;
+ while (matcher.find()) {
+ matcher.appendReplacement(sb, "");
+ sb.append(matcher.group(1)).append(matcher.group(2)).append(matcher.group(3)).append("`END");
+ found = true;
+ }
+ matcher.appendTail(sb);
+ result = sb.toString();
+ if (!found) {
+ break;
+ }
+ }
+ }
+
+ StringBuffer sb = new StringBuffer();
+ Pattern pattern = Pattern.compile("`([A-Z]{3})([^`]*?)`END", Pattern.MULTILINE | Pattern.DOTALL);
+ Matcher matcher = pattern.matcher(result);
+ while (matcher.find()) {
+ matcher.appendReplacement(sb, "");
+ sb.append(matcher.group(2));
+
+ returnList.add(count);
+ returnList.add(matcher.group(1).toLowerCase());
+ count += matcher.group(2).length();
+ }
+ matcher.appendTail(sb);
+ String plainCode = sb.toString();
+
+ if (removeNewLine) {
+ // use TreeMap to remove entrys with same pos
+ Map<Integer, Object> orderedMap = new TreeMap<Integer, Object>();
+ for (int i = 0, iEnd = returnList.size(); i < iEnd; i++) {
+ orderedMap.put((Integer) returnList.get(i), returnList.get(i + 1));
+ i++;
+ }
+ // remove adjacent style
+ List<Object> _returnList = new ArrayList<Object>(orderedMap.size() + 1);
+ String previousStyle = null;
+ for (Integer _pos : orderedMap.keySet()) {
+ if (previousStyle != null && previousStyle.equals(orderedMap.get(_pos))) {
+ continue;
+ }
+ _returnList.add(_pos);
+ _returnList.add(orderedMap.get(_pos));
+ previousStyle = (String) orderedMap.get(_pos);
+ }
+ returnList = _returnList;
+ }
+
+// System.out.println(plainCode);
+ for (int i = 0, iEnd = returnList.size(); i < iEnd; i++) {
+ int end = i + 2 < iEnd ? (Integer) returnList.get(i + 2) : plainCode.length();
+// System.out.println(returnList.get(i) + ": " + returnList.get(i + 1) + ": " + plainCode.substring((Integer) returnList.get(i), end));
+ i++;
+ }
+
+ return returnList;
+ }
+}
diff --git a/test/prettify/PrettifyTest/result/C.txt b/test/prettify/PrettifyTest/result/C.txt
new file mode 100644
index 0000000..d4e9249
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/C.txt
@@ -0,0 +1,18 @@
+`COM#include`END`PLN `END`STR<stdio.h>`END`PLN
+
+`END`COM/* the n-th fibonacci number.
+ */`END`PLN
+`END`KWDunsigned`END`PLN `END`KWDint`END`PLN fib`END`PUN(`END`KWDunsigned`END`PLN `END`KWDint`END`PLN n`END`PUN)`END`PLN `END`PUN{`END`PLN
+ `END`KWDunsigned`END`PLN `END`KWDint`END`PLN a `END`PUN=`END`PLN `END`LIT1`END`PUN,`END`PLN b `END`PUN=`END`PLN `END`LIT1`END`PUN;`END`PLN
+ `END`KWDunsigned`END`PLN `END`KWDint`END`PLN tmp`END`PUN;`END`PLN
+ `END`KWDwhile`END`PLN `END`PUN(--`END`PLNn `END`PUN>=`END`PLN `END`LIT0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ tmp `END`PUN=`END`PLN a`END`PUN;`END`PLN
+ a `END`PUN+=`END`PLN b`END`PUN;`END`PLN
+ b `END`PUN=`END`PLN tmp`END`PUN;`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDreturn`END`PLN a`END`PUN;`END`PLN
+`END`PUN}`END`PLN
+
+main`END`PUN()`END`PLN `END`PUN{`END`PLN
+ printf`END`PUN(`END`STR"%u"`END`PUN,`END`PLN fib`END`PUN(`END`LIT10`END`PUN));`END`PLN
+`END`PUN}`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/C_lang.txt b/test/prettify/PrettifyTest/result/C_lang.txt
new file mode 100644
index 0000000..9e666f6
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/C_lang.txt
@@ -0,0 +1,22 @@
+`COM#include`END`PLN `END`STR<stdio.h>`END`PLN
+
+`END`COM/* the nth fibonacci number. */`END`PLN
+`END`TYPuint32`END`PLN fib`END`PUN(`END`KWDunsigned`END`PLN `END`TYPint`END`PLN n`END`PUN)`END`PLN `END`PUN{`END`PLN
+ `END`TYPuint32`END`PLN a `END`PUN=`END`PLN `END`LIT1`END`PUN,`END`PLN b `END`PUN=`END`PLN `END`LIT1`END`PUN;`END`PLN
+ `END`TYPuint32`END`PLN tmp`END`PUN;`END`PLN
+ `END`KWDwhile`END`PLN `END`PUN(--`END`PLNn `END`PUN>=`END`PLN `END`LIT0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ tmp `END`PUN=`END`PLN a`END`PUN;`END`PLN
+ a `END`PUN+=`END`PLN b`END`PUN;`END`PLN
+ b `END`PUN=`END`PLN tmp`END`PUN;`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDreturn`END`PLN a`END`PUN;`END`PLN
+`END`PUN}`END`PLN
+
+`END`KWDvoid`END`PLN main`END`PUN()`END`PLN `END`PUN{`END`PLN
+ `END`TYPsize_t`END`PLN size `END`PUN=`END`PLN `END`KWDsizeof`END`PUN(`END`TYPwchar_t`END`PUN);`END`PLN
+ ASSERT_EQ`END`PUN(`END`PLNsize`END`PUN,`END`PLN `END`LIT1`END`PUN);`END`PLN
+ printf`END`PUN(`END`STR"%u"`END`PUN,`END`PLN fib`END`PUN(`END`LIT10`END`PUN));`END`PLN
+`END`PUN}`END`PLN
+
+`END`COM#define`END`PLN ZERO `END`LIT0`END`PLN `END`COM/* a
+ multiline comment */`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/Cpp.txt b/test/prettify/PrettifyTest/result/Cpp.txt
new file mode 100644
index 0000000..8c7abb1
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/Cpp.txt
@@ -0,0 +1,22 @@
+`COM#include`END`PLN `END`STR<iostream>`END`PLN
+
+`END`KWDusing`END`PLN `END`KWDnamespace`END`PLN std`END`PUN;`END`PLN
+
+`END`COM//! fibonacci numbers with gratuitous use of templates.`END`PLN
+`END`COM//! \param n an index into the fibonacci series`END`PLN
+`END`COM//! \param fib0 element 0 of the series`END`PLN
+`END`COM//! \return the nth element of the fibonacci series`END`PLN
+`END`KWDtemplate`END`PLN `END`PUN<`END`KWDclass`END`PLN T`END`PUN>`END`PLN
+T fib`END`PUN(`END`KWDunsigned`END`PLN `END`KWDint`END`PLN n`END`PUN,`END`PLN `END`KWDconst`END`PLN T`END`PUN&`END`PLN fib0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ T a`END`PUN(`END`PLNfib0`END`PUN),`END`PLN b`END`PUN(`END`PLNfib0`END`PUN);`END`PLN
+ `END`KWDfor`END`PLN `END`PUN(;`END`PLN n`END`PUN;`END`PLN `END`PUN--`END`PLNn`END`PUN)`END`PLN `END`PUN{`END`PLN
+ T tmp`END`PUN(`END`PLNa`END`PUN);`END`PLN
+ a `END`PUN+=`END`PLN b`END`PUN;`END`PLN
+ b `END`PUN=`END`PLN tmp`END`PUN;`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDreturn`END`PLN a`END`PUN;`END`PLN
+`END`PUN}`END`PLN
+
+`END`KWDint`END`PLN main`END`PUN(`END`KWDint`END`PLN argc`END`PUN,`END`PLN `END`KWDchar`END`PLN `END`PUN**`END`PLNargv`END`PUN)`END`PLN `END`PUN{`END`PLN
+ cout `END`PUN<<`END`PLN fib`END`PUN(`END`LIT10`END`PUN,`END`PLN `END`LIT1U`END`PUN);`END`PLN
+`END`PUN}`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/Cpp_lang.txt b/test/prettify/PrettifyTest/result/Cpp_lang.txt
new file mode 100644
index 0000000..079520f
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/Cpp_lang.txt
@@ -0,0 +1,22 @@
+`COM#include`END`PLN `END`STR<iostream>`END`PLN
+
+`END`KWDusing`END`PLN `END`KWDnamespace`END`PLN std`END`PUN;`END`PLN
+
+`END`COM//! fibonacci numbers with gratuitous use of templates.`END`PLN
+`END`COM//! \param n an index into the fibonacci series`END`PLN
+`END`COM//! \param fib0 element 0 of the series`END`PLN
+`END`COM//! \return the nth element of the fibonacci series`END`PLN
+`END`KWDtemplate`END`PLN `END`PUN<`END`KWDclass`END`PLN T`END`PUN>`END`PLN
+T fib`END`PUN(`END`TYPint`END`PLN n`END`PUN,`END`PLN `END`KWDconst`END`PLN T`END`PUN&`END`PLN fib0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ T a`END`PUN(`END`PLNfib0`END`PUN),`END`PLN b`END`PUN(`END`PLNfib0`END`PUN);`END`PLN
+ `END`KWDwhile`END`PLN `END`PUN(--`END`PLNn `END`PUN>=`END`PLN `END`LIT0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ T tmp`END`PUN(`END`PLNa`END`PUN);`END`PLN
+ a `END`PUN+=`END`PLN b`END`PUN;`END`PLN
+ b `END`PUN=`END`PLN tmp`END`PUN;`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDreturn`END`PLN a`END`PUN;`END`PLN
+`END`PUN}`END`PLN
+
+`END`TYPint`END`PLN main`END`PUN(`END`TYPint`END`PLN argc`END`PUN,`END`PLN `END`KWDchar`END`PLN `END`PUN**`END`PLNargv`END`PUN)`END`PLN `END`PUN{`END`PLN
+ cout `END`PUN<<`END`PLN fib`END`PUN(`END`LIT10`END`PUN,`END`PLN `END`LIT1U`END`PUN);`END`PLN
+`END`PUN}`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/PHP.txt b/test/prettify/PrettifyTest/result/PHP.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/PHP.txt
diff --git a/test/prettify/PrettifyTest/result/bash.txt b/test/prettify/PrettifyTest/result/bash.txt
new file mode 100644
index 0000000..7652a66
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/bash.txt
@@ -0,0 +1,17 @@
+`COM#!/bin/bash`END`PLN
+
+`END`COM# Fibonacci numbers`END`PLN
+`END`COM# Writes an infinite series to stdout, one entry per line`END`PLN
+`END`KWDfunction`END`PLN fib`END`PUN()`END`PLN `END`PUN{`END`PLN
+ `END`KWDlocal`END`PLN a`END`PUN=`END`LIT1`END`PLN
+ `END`KWDlocal`END`PLN b`END`PUN=`END`LIT1`END`PLN
+ `END`KWDwhile`END`PLN `END`KWDtrue`END`PLN `END`PUN;`END`PLN `END`KWDdo`END`PLN
+ echo $a
+ `END`KWDlocal`END`PLN tmp`END`PUN=`END`PLN$a
+ a`END`PUN=`END`PLN$`END`PUN((`END`PLN $a `END`PUN+`END`PLN $b `END`PUN))`END`PLN
+ b`END`PUN=`END`PLN$tmp
+ `END`KWDdone`END`PLN
+`END`PUN}`END`PLN
+
+`END`COM# output the 10th element of the series and halt`END`PLN
+fib `END`PUN|`END`PLN head `END`PUN-`END`LIT10`END`PLN `END`PUN|`END`PLN tail `END`PUN-`END`LIT1`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/bash_lang.txt b/test/prettify/PrettifyTest/result/bash_lang.txt
new file mode 100644
index 0000000..c959536
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/bash_lang.txt
@@ -0,0 +1,17 @@
+`COM#!/bin/bash`END
+`PLN `END
+`COM# Fibonacci numbers`END
+`COM# Writes an infinite series to stdout, one entry per line`END
+`KWDfunction`END`PLN fib`END`PUN()`END`PLN `END`PUN{`END
+`PLN `END`KWDlocal`END`PLN a`END`PUN=`END`LIT1`END
+`PLN `END`KWDlocal`END`PLN b`END`PUN=`END`LIT1`END
+`PLN `END`KWDwhile`END`PLN true `END`PUN;`END`PLN `END`KWDdo`END
+`PLN echo $a`END
+`PLN `END`KWDlocal`END`PLN tmp`END`PUN=`END`PLN$a`END
+`PLN a`END`PUN=`END`PLN$`END`PUN((`END`PLN $a `END`PUN+`END`PLN $b `END`PUN))`END
+`PLN b`END`PUN=`END`PLN$tmp`END
+`PLN `END`KWDdone`END
+`PUN}`END
+`PLN `END
+`COM# output the 10th element of the series and halt`END
+`PLNfib `END`PUN|`END`PLN `END`PUN/`END`PLNusr`END`PUN/`END`PLNbin`END`PUN/*`END`PLNhead `END`PUN-`END`LIT10`END`PLN `END`PUN|`END`PLN tail `END`PUN-`END`LIT1`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/coffee.txt b/test/prettify/PrettifyTest/result/coffee.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/coffee.txt
diff --git a/test/prettify/PrettifyTest/result/css.txt b/test/prettify/PrettifyTest/result/css.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/css.txt
diff --git a/test/prettify/PrettifyTest/result/go.txt b/test/prettify/PrettifyTest/result/go.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/go.txt
diff --git a/test/prettify/PrettifyTest/result/html.txt b/test/prettify/PrettifyTest/result/html.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/html.txt
diff --git a/test/prettify/PrettifyTest/result/htmlXmp.txt b/test/prettify/PrettifyTest/result/htmlXmp.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/htmlXmp.txt
diff --git a/test/prettify/PrettifyTest/result/html_lang.txt b/test/prettify/PrettifyTest/result/html_lang.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/html_lang.txt
diff --git a/test/prettify/PrettifyTest/result/issue12.txt b/test/prettify/PrettifyTest/result/issue12.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue12.txt
diff --git a/test/prettify/PrettifyTest/result/issue12_lang.txt b/test/prettify/PrettifyTest/result/issue12_lang.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue12_lang.txt
diff --git a/test/prettify/PrettifyTest/result/issue14a.txt b/test/prettify/PrettifyTest/result/issue14a.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue14a.txt
diff --git a/test/prettify/PrettifyTest/result/issue14b.txt b/test/prettify/PrettifyTest/result/issue14b.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue14b.txt
diff --git a/test/prettify/PrettifyTest/result/issue20.txt b/test/prettify/PrettifyTest/result/issue20.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue20.txt
diff --git a/test/prettify/PrettifyTest/result/issue21.txt b/test/prettify/PrettifyTest/result/issue21.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue21.txt
diff --git a/test/prettify/PrettifyTest/result/issue24.txt b/test/prettify/PrettifyTest/result/issue24.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue24.txt
diff --git a/test/prettify/PrettifyTest/result/issue27.txt b/test/prettify/PrettifyTest/result/issue27.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue27.txt
diff --git a/test/prettify/PrettifyTest/result/issue30.txt b/test/prettify/PrettifyTest/result/issue30.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue30.txt
diff --git a/test/prettify/PrettifyTest/result/issue33.txt b/test/prettify/PrettifyTest/result/issue33.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue33.txt
diff --git a/test/prettify/PrettifyTest/result/issue4.txt b/test/prettify/PrettifyTest/result/issue4.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue4.txt
diff --git a/test/prettify/PrettifyTest/result/issue42.txt b/test/prettify/PrettifyTest/result/issue42.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue42.txt
diff --git a/test/prettify/PrettifyTest/result/issue79.txt b/test/prettify/PrettifyTest/result/issue79.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue79.txt
diff --git a/test/prettify/PrettifyTest/result/issue8.txt b/test/prettify/PrettifyTest/result/issue8.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue8.txt
diff --git a/test/prettify/PrettifyTest/result/issue84.txt b/test/prettify/PrettifyTest/result/issue84.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue84.txt
diff --git a/test/prettify/PrettifyTest/result/issue92.txt b/test/prettify/PrettifyTest/result/issue92.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue92.txt
diff --git a/test/prettify/PrettifyTest/result/issue93.txt b/test/prettify/PrettifyTest/result/issue93.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/issue93.txt
diff --git a/test/prettify/PrettifyTest/result/isue45.txt b/test/prettify/PrettifyTest/result/isue45.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/isue45.txt
diff --git a/test/prettify/PrettifyTest/result/java.txt b/test/prettify/PrettifyTest/result/java.txt
new file mode 100644
index 0000000..fbebc19
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/java.txt
@@ -0,0 +1,44 @@
+`KWDpackage`END`PLN foo`END`PUN;`END`PLN
+
+`END`KWDimport`END`PLN java`END`PUN.`END`PLNutil`END`PUN.`END`TYPIterator`END`PUN;`END`PLN
+
+`END`COM/**
+ * the fibonacci series implemented as an Iterable.
+ */`END`PLN
+`END`KWDpublic`END`PLN `END`KWDfinal`END`PLN `END`KWDclass`END`PLN `END`TYPFibonacci`END`PLN `END`KWDimplements`END`PLN `END`TYPIterable`END`PUN<`END`TYPInteger`END`PUN>`END`PLN `END`PUN{`END`PLN
+ `END`COM/** the next and previous members of the series. */`END`PLN
+ `END`KWDprivate`END`PLN `END`KWDint`END`PLN a `END`PUN=`END`PLN `END`LIT1`END`PUN,`END`PLN b `END`PUN=`END`PLN `END`LIT1`END`PUN;`END`PLN
+
+ `END`LIT@Override`END`PLN
+ `END`KWDpublic`END`PLN `END`TYPIterator`END`PUN<`END`TYPInteger`END`PUN>`END`PLN iterator`END`PUN()`END`PLN `END`PUN{`END`PLN
+ `END`KWDreturn`END`PLN `END`KWDnew`END`PLN `END`TYPIterator`END`PUN<`END`TYPInteger`END`PUN>()`END`PLN `END`PUN{`END`PLN
+ `END`COM/** the series is infinite. */`END`PLN
+ `END`KWDpublic`END`PLN `END`KWDboolean`END`PLN hasNext`END`PUN()`END`PLN `END`PUN{`END`PLN `END`KWDreturn`END`PLN `END`KWDtrue`END`PUN;`END`PLN `END`PUN}`END`PLN
+ `END`KWDpublic`END`PLN `END`TYPInteger`END`PLN `END`KWDnext`END`PUN()`END`PLN `END`PUN{`END`PLN
+ `END`KWDint`END`PLN tmp `END`PUN=`END`PLN a`END`PUN;`END`PLN
+ a `END`PUN+=`END`PLN b`END`PUN;`END`PLN
+ b `END`PUN=`END`PLN tmp`END`PUN;`END`PLN
+ `END`KWDreturn`END`PLN a`END`PUN;`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDpublic`END`PLN `END`KWDvoid`END`PLN remove`END`PUN()`END`PLN `END`PUN{`END`PLN `END`KWDthrow`END`PLN `END`KWDnew`END`PLN `END`TYPUnsupportedOperationException`END`PUN();`END`PLN `END`PUN}`END`PLN
+ `END`PUN};`END`PLN
+ `END`PUN}`END`PLN
+
+ `END`COM/**
+ * the n<sup>th</sup> element of the given series.
+ * @throws NoSuchElementException if there are less than n elements in the
+ * given Iterable's {@link Iterable#iterator iterator}.
+ */`END`PLN
+ `END`KWDpublic`END`PLN `END`KWDstatic`END`PLN `END`PUN<`END`PLNT`END`PUN>`END`PLN
+ T nth`END`PUN(`END`KWDint`END`PLN n`END`PUN,`END`PLN `END`TYPIterable`END`PUN<`END`PLNT`END`PUN>`END`PLN iterable`END`PUN)`END`PLN `END`PUN{`END`PLN
+ `END`TYPIterator`END`PUN<?`END`PLN `END`KWDextends`END`PLN T`END`PUN>`END`PLN it `END`PUN=`END`PLN iterable`END`PUN.`END`PLNiterator`END`PUN();`END`PLN
+ `END`KWDwhile`END`PLN `END`PUN(--`END`PLNn `END`PUN>`END`PLN `END`LIT0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ it`END`PUN.`END`KWDnext`END`PUN();`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDreturn`END`PLN it`END`PUN.`END`KWDnext`END`PUN();`END`PLN
+ `END`PUN}`END`PLN
+
+ `END`KWDpublic`END`PLN `END`KWDstatic`END`PLN `END`KWDvoid`END`PLN main`END`PUN(`END`TYPString`END`PUN[]`END`PLN args`END`PUN)`END`PLN `END`PUN{`END`PLN
+ `END`TYPSystem`END`PUN.`END`KWDout`END`PUN.`END`KWDprint`END`PUN(`END`PLNnth`END`PUN(`END`LIT10`END`PUN,`END`PLN `END`KWDnew`END`PLN `END`TYPFibonacci`END`PUN()));`END`PLN
+ `END`PUN}`END`PLN
+`END`PUN}`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/java_lang.txt b/test/prettify/PrettifyTest/result/java_lang.txt
new file mode 100644
index 0000000..84dc207
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/java_lang.txt
@@ -0,0 +1,47 @@
+`KWDpackage`END`PLN foo`END`PUN;`END
+`PLN `END
+`KWDimport`END`PLN java`END`PUN.`END`PLNutil`END`PUN.`END`TYPIterator`END`PUN;`END
+`PLN `END
+`COM/**`END
+`COM * the fibonacci series implemented as an Iterable.`END
+`COM */`END
+`KWDpublic`END`PLN `END`KWDfinal`END`PLN `END`KWDclass`END`PLN `END`TYPFibonacci`END`PLN `END`KWDimplements`END`PLN `END`TYPIterable`END`PUN<`END`TYPInteger`END`PUN>`END`PLN `END`PUN{`END
+`PLN `END`COM/** the next and previous members of the series. */`END
+`PLN `END`KWDprivate`END`PLN `END`KWDint`END`PLN a `END`PUN=`END`PLN `END`LIT1`END`PUN,`END`PLN b `END`PUN=`END`PLN `END`LIT1`END`PUN;`END
+`PLN `END
+`PLN `END`LIT@Override`END
+`PLN `END`KWDpublic`END`PLN `END`TYPIterator`END`PUN<`END`TYPInteger`END`PUN>`END`PLN iterator`END`PUN()`END`PLN `END`PUN{`END
+`PLN `END`KWDreturn`END`PLN `END`KWDnew`END`PLN `END`TYPIterator`END`PUN<`END`TYPInteger`END`PUN>()`END`PLN `END`PUN{`END
+`PLN `END`COM/** the series is infinite. */`END
+`PLN `END`KWDpublic`END`PLN `END`KWDboolean`END`PLN hasNext`END`PUN()`END`PLN `END`PUN{`END`PLN `END`KWDreturn`END`PLN `END`KWDtrue`END`PUN;`END`PLN `END`PUN}`END
+`PLN `END`KWDpublic`END`PLN `END`TYPInteger`END`PLN next`END`PUN()`END`PLN `END`PUN{`END
+`PLN `END`KWDint`END`PLN tmp `END`PUN=`END`PLN a`END`PUN;`END
+`PLN a `END`PUN+=`END`PLN b`END`PUN;`END
+`PLN b `END`PUN=`END`PLN tmp`END`PUN;`END
+`PLN `END`KWDreturn`END`PLN a`END`PUN;`END
+`PLN `END`PUN}`END
+`PLN `END`KWDpublic`END`PLN `END`KWDvoid`END`PLN remove`END`PUN()`END`PLN `END`PUN{`END`PLN `END`KWDthrow`END`PLN `END`KWDnew`END`PLN `END`TYPUnsupportedOperationException`END`PUN();`END`PLN `END`PUN}`END
+`PLN `END`PUN};`END
+`PLN `END`PUN}`END
+`PLN `END
+`PLN `END`COM/**`END
+`COM * the n<sup>th</sup> element of the given series.`END
+`COM * @throws NoSuchElementException if there are less than n elements in the`END
+`COM * given Iterable's {@link Iterable#iterator iterator}.`END
+`COM */`END
+`PLN `END`KWDpublic`END`PLN `END`KWDstatic`END`PLN `END`PUN<`END`PLNT`END`PUN>`END
+`PLN T nth`END`PUN(`END`KWDint`END`PLN n`END`PUN,`END`PLN `END`TYPIterable`END`PUN<`END`PLNT`END`PUN>`END`PLN iterable`END`PUN)`END`PLN `END`PUN{`END
+`PLN `END`TYPIterator`END`PUN<?`END`PLN `END`KWDextends`END`PLN T`END`PUN>`END`PLN in `END`PUN=`END`PLN iterable`END`PUN.`END`PLNiterator`END`PUN();`END
+`PLN `END`KWDwhile`END`PLN `END`PUN(--`END`PLNn `END`PUN>`END`PLN `END`LIT0`END`PUN)`END`PLN `END`PUN{`END
+`PLN in`END`PUN.`END`PLNnext`END`PUN();`END
+`PLN `END`PUN}`END
+`PLN `END`KWDreturn`END`PLN in`END`PUN.`END`PLNnext`END`PUN();`END
+`PLN `END`PUN}`END
+`PLN `END
+`PLN `END`KWDpublic`END`PLN `END`KWDstatic`END`PLN `END`KWDvoid`END`PLN main`END`PUN(`END`TYPString`END`PUN[]`END`PLN args`END`PUN)`END`PLN `END`PUN{`END
+`PLN `END`TYPSystem`END`PUN.`END`PLNout`END`PUN.`END`PLNprint`END`PUN(`END`PLNnth`END`PUN(`END`LIT10`END`PUN,`END`PLN `END`KWDnew`END`PLN `END`TYPFibonacci`END`PUN()));`END
+`PLN `END`PUN}`END
+`PUN}`END
+`PLN `END
+`PUN#`END`PLN not a java comment`END
+`PUN#`END`PLN not keywords`END`PUN:`END`PLN static_cast and namespace`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/javascript.txt b/test/prettify/PrettifyTest/result/javascript.txt
new file mode 100644
index 0000000..c2daa2b
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/javascript.txt
@@ -0,0 +1,17 @@
+`COM/**
+ * nth element in the fibonacci series.
+ * @param n >= 0
+ * @return the nth element, >= 0.
+ */`END`PLN
+`END`KWDfunction`END`PLN fib`END`PUN(`END`PLNn`END`PUN)`END`PLN `END`PUN{`END`PLN
+ `END`KWDvar`END`PLN a `END`PUN=`END`PLN `END`LIT1`END`PUN,`END`PLN b `END`PUN=`END`PLN `END`LIT1`END`PUN;`END`PLN
+ `END`KWDvar`END`PLN tmp`END`PUN;`END`PLN
+ `END`KWDwhile`END`PLN `END`PUN(--`END`PLNn `END`PUN>=`END`PLN `END`LIT0`END`PUN)`END`PLN `END`PUN{`END`PLN
+ tmp `END`PUN=`END`PLN a`END`PUN;`END`PLN
+ a `END`PUN+=`END`PLN b`END`PUN;`END`PLN
+ b `END`PUN=`END`PLN tmp`END`PUN;`END`PLN
+ `END`PUN}`END`PLN
+ `END`KWDreturn`END`PLN a`END`PUN;`END`PLN
+`END`PUN}`END`PLN
+
+document`END`PUN.`END`PLNwrite`END`PUN(`END`PLNfib`END`PUN(`END`LIT10`END`PUN));`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/misc1.txt b/test/prettify/PrettifyTest/result/misc1.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/misc1.txt
diff --git a/test/prettify/PrettifyTest/result/perl.txt b/test/prettify/PrettifyTest/result/perl.txt
new file mode 100644
index 0000000..31ccf14
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/perl.txt
@@ -0,0 +1,15 @@
+`COM#!/usr/bin/perl`END`PLN
+
+`END`KWDuse`END`PLN strict`END`PUN;`END`PLN
+`END`KWDuse`END`PLN integer`END`PUN;`END`PLN
+
+`END`COM# the nth element of the fibonacci series`END`PLN
+`END`COM# param n - an int >= 0`END`PLN
+`END`COM# return an int >= 0`END`PLN
+`END`KWDsub`END`PLN fib`END`PUN(`END`PLN$`END`PUN)`END`PLN `END`PUN{`END`PLN
+ `END`KWDmy`END`PLN $n `END`PUN=`END`PLN shift`END`PUN,`END`PLN $a `END`PUN=`END`PLN `END`LIT1`END`PUN,`END`PLN $b `END`PUN=`END`PLN `END`LIT1`END`PUN;`END`PLN
+ `END`PUN(`END`PLN$a`END`PUN,`END`PLN $b`END`PUN)`END`PLN `END`PUN=`END`PLN `END`PUN(`END`PLN$a `END`PUN+`END`PLN $b`END`PUN,`END`PLN $a`END`PUN)`END`PLN `END`KWDuntil`END`PLN `END`PUN(--`END`PLN$n `END`PUN<`END`PLN `END`LIT0`END`PUN);`END`PLN
+ `END`KWDreturn`END`PLN $a`END`PUN;`END`PLN
+`END`PUN}`END`PLN
+
+`END`KWDprint`END`PLN fib`END`PUN(`END`LIT10`END`PUN);`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/proto.txt b/test/prettify/PrettifyTest/result/proto.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/proto.txt
diff --git a/test/prettify/PrettifyTest/result/python.txt b/test/prettify/PrettifyTest/result/python.txt
new file mode 100644
index 0000000..4b1173b
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/python.txt
@@ -0,0 +1,24 @@
+`COM#!/usr/bin/python2.4`END`PLN
+
+`END`KWDdef`END`PLN fib`END`PUN():`END`PLN
+ `END`STR'''
+ a generator that produces the elements of the fibonacci series
+ '''`END`PLN
+
+ a `END`PUN=`END`PLN `END`LIT1`END`PLN
+ b `END`PUN=`END`PLN `END`LIT1`END`PLN
+ `END`KWDwhile`END`PLN `END`KWDTrue`END`PUN:`END`PLN
+ a`END`PUN,`END`PLN b `END`PUN=`END`PLN a `END`PUN+`END`PLN b`END`PUN,`END`PLN a
+ `END`KWDyield`END`PLN a
+
+`END`KWDdef`END`PLN nth`END`PUN(`END`PLNseries`END`PUN,`END`PLN n`END`PUN):`END`PLN
+ `END`STR'''
+ returns the nth element of a series,
+ consuming the earlier elements of the series
+ '''`END`PLN
+
+ `END`KWDfor`END`PLN x `END`KWDin`END`PLN series`END`PUN:`END`PLN
+ n `END`PUN=`END`PLN n `END`PUN-`END`PLN `END`LIT1`END`PLN
+ `END`KWDif`END`PLN n `END`PUN<=`END`PLN `END`LIT0`END`PUN:`END`PLN `END`KWDreturn`END`PLN x
+
+`END`KWDprint`END`PLN nth`END`PUN(`END`PLNfib`END`PUN(),`END`PLN `END`LIT10`END`PUN)`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/python_lang.txt b/test/prettify/PrettifyTest/result/python_lang.txt
new file mode 100644
index 0000000..03b4ed2
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/python_lang.txt
@@ -0,0 +1,26 @@
+`COM#!/usr/bin/python2.4`END`PLN
+
+`END`KWDdef`END`PLN fib`END`PUN():`END`PLN
+ `END`STR'''
+ a generator that produces the fibonacci series's elements
+ '''`END`PLN
+
+ a `END`PUN=`END`PLN `END`LIT1`END`PLN
+ b `END`PUN=`END`PLN `END`LIT1`END`PLN
+ `END`KWDwhile`END`PLN `END`KWDTrue`END`PUN:`END`PLN
+ a`END`PUN,`END`PLN b `END`PUN=`END`PLN a `END`PUN+`END`PLN b`END`PUN,`END`PLN a
+ `END`KWDyield`END`PLN a
+
+`END`KWDdef`END`PLN nth`END`PUN(`END`PLNseries`END`PUN,`END`PLN n`END`PUN):`END`PLN
+ `END`STR'''
+ returns the nth element of a series,
+ consuming the series' earlier elements.
+ '''`END`PLN
+
+ `END`KWDfor`END`PLN x `END`KWDin`END`PLN series`END`PUN:`END`PLN
+ n `END`PUN-=`END`PLN `END`LIT1`END`PLN
+ `END`KWDif`END`PLN n `END`PUN<=`END`PLN `END`LIT0`END`PUN:`END`PLN `END`KWDreturn`END`PLN x
+
+`END`KWDprint`END`PLN nth`END`PUN(`END`PLNfib`END`PUN(),`END`PLN `END`LIT10`END`PUN)`END`PLN
+
+`END`PUN/*`END`PLN `END`KWDnot`END`PLN a comment `END`KWDand`END`PLN `END`KWDnot`END`PLN keywords`END`PUN:`END`PLN null char true `END`PUN*/`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/scala.txt b/test/prettify/PrettifyTest/result/scala.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/scala.txt
diff --git a/test/prettify/PrettifyTest/result/sql_lang.txt b/test/prettify/PrettifyTest/result/sql_lang.txt
new file mode 100644
index 0000000..afaad91
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/sql_lang.txt
@@ -0,0 +1,9 @@
+`COM/* A multi-line
+ * comment */`END`PLN
+`END`STR'Another string /* Isn\'t a comment'`END`PUN,`END`PLN
+`END`STR"A string */"`END`PLN
+`END`COM-- A line comment`END`PLN
+`END`KWDSELECT`END`PLN `END`PUN*`END`PLN `END`KWDFROM`END`PLN users `END`KWDWHERE`END`PLN id `END`KWDIN`END`PLN `END`PUN(`END`LIT1`END`PUN,`END`PLN `END`LIT2.0`END`PUN,`END`PLN `END`LIT+30e-1`END`PUN);`END`PLN
+`END`COM-- keywords are case-insensitive.`END`PLN
+`END`COM-- Note: user-table is a single identifier, not a pair of keywords`END`PLN
+`END`KWDselect`END`PLN `END`PUN*`END`PLN `END`KWDfrom`END`PLN user-table `END`KWDwhere`END`PLN id `END`KWDin`END`PLN `END`PUN(`END`PLNx`END`PUN,`END`PLN y`END`PUN,`END`PLN z`END`PUN);`END
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/result/vhdl.txt b/test/prettify/PrettifyTest/result/vhdl.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/vhdl.txt
diff --git a/test/prettify/PrettifyTest/result/wiki.txt b/test/prettify/PrettifyTest/result/wiki.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/wiki.txt
diff --git a/test/prettify/PrettifyTest/result/xhtml.txt b/test/prettify/PrettifyTest/result/xhtml.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/xhtml.txt
diff --git a/test/prettify/PrettifyTest/result/xml.txt b/test/prettify/PrettifyTest/result/xml.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/xml.txt
diff --git a/test/prettify/PrettifyTest/result/xsl.txt b/test/prettify/PrettifyTest/result/xsl.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/xsl.txt
diff --git a/test/prettify/PrettifyTest/result/yaml1.txt b/test/prettify/PrettifyTest/result/yaml1.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/yaml1.txt
diff --git a/test/prettify/PrettifyTest/result/yaml2.txt b/test/prettify/PrettifyTest/result/yaml2.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/prettify/PrettifyTest/result/yaml2.txt
diff --git a/test/prettify/PrettifyTest/source/C.txt b/test/prettify/PrettifyTest/source/C.txt
new file mode 100644
index 0000000..d112459
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/C.txt
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+/* the n-th fibonacci number.
+ */
+unsigned int fib(unsigned int n) {
+ unsigned int a = 1, b = 1;
+ unsigned int tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+main() {
+ printf("%u", fib(10));
+}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/C_lang.txt b/test/prettify/PrettifyTest/source/C_lang.txt
new file mode 100644
index 0000000..69bd4eb
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/C_lang.txt
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+/* the nth fibonacci number. */
+uint32 fib(unsigned int n) {
+ uint32 a = 1, b = 1;
+ uint32 tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+void main() {
+ size_t size = sizeof(wchar_t);
+ ASSERT_EQ(size, 1);
+ printf("%u", fib(10));
+}
+
+#define ZERO 0 /* a
+ multiline comment */
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/Cpp.txt b/test/prettify/PrettifyTest/source/Cpp.txt
new file mode 100644
index 0000000..449d7d6
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/Cpp.txt
@@ -0,0 +1,22 @@
+#include <iostream>
+
+using namespace std;
+
+//! fibonacci numbers with gratuitous use of templates.
+//! \param n an index into the fibonacci series
+//! \param fib0 element 0 of the series
+//! \return the nth element of the fibonacci series
+template <class T>
+T fib(unsigned int n, const T& fib0) {
+ T a(fib0), b(fib0);
+ for (; n; --n) {
+ T tmp(a);
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+int main(int argc, char **argv) {
+ cout << fib(10, 1U);
+}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/Cpp_lang.txt b/test/prettify/PrettifyTest/source/Cpp_lang.txt
new file mode 100644
index 0000000..fe6c544
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/Cpp_lang.txt
@@ -0,0 +1,22 @@
+#include <iostream>
+
+using namespace std;
+
+//! fibonacci numbers with gratuitous use of templates.
+//! \param n an index into the fibonacci series
+//! \param fib0 element 0 of the series
+//! \return the nth element of the fibonacci series
+template <class T>
+T fib(int n, const T& fib0) {
+ T a(fib0), b(fib0);
+ while (--n >= 0) {
+ T tmp(a);
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+int main(int argc, char **argv) {
+ cout << fib(10, 1U);
+}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/PHP.txt b/test/prettify/PrettifyTest/source/PHP.txt
new file mode 100644
index 0000000..9525d8c
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/PHP.txt
@@ -0,0 +1,25 @@
+<html>
+ <head>
+ <title><?= 'Fibonacci numbers' ?></title>
+
+ <?php
+ // PHP has a plethora of comment types
+ /* What is a
+ "plethora"? */
+ function fib($n) {
+ # I don't know.
+ $a = 1;
+ $b = 1;
+ while (--$n >= 0) {
+ echo "$a\n";
+ $tmp = $a;
+ $a += $b;
+ $b = $tmp;
+ }
+ }
+ ?>
+ </head>
+ <body>
+ <?= fib(10) ?>
+ </body>
+</html>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/bash.txt b/test/prettify/PrettifyTest/source/bash.txt
new file mode 100644
index 0000000..4dd5499
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/bash.txt
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Fibonacci numbers
+# Writes an infinite series to stdout, one entry per line
+function fib() {
+ local a=1
+ local b=1
+ while true ; do
+ echo $a
+ local tmp=$a
+ a=$(( $a + $b ))
+ b=$tmp
+ done
+}
+
+# output the 10th element of the series and halt
+fib | head -10 | tail -1
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/bash_lang.txt b/test/prettify/PrettifyTest/source/bash_lang.txt
new file mode 100644
index 0000000..eba1ab1
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/bash_lang.txt
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Fibonacci numbers
+# Writes an infinite series to stdout, one entry per line
+function fib() {
+ local a=1
+ local b=1
+ while true ; do
+ echo $a
+ local tmp=$a
+ a=$(( $a + $b ))
+ b=$tmp
+ done
+}
+
+# output the 10th element of the series and halt
+fib | /usr/bin/*head -10 | tail -1
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/coffee.txt b/test/prettify/PrettifyTest/source/coffee.txt
new file mode 100644
index 0000000..c2240a7
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/coffee.txt
@@ -0,0 +1,47 @@
+class Animal
+ constructor: (@name) ->
+ move: (meters, loc) ->
+ alert @name + " moved " + meters + "m."
+ travel: (path...) ->
+ for place in path
+ @move place.distance, place.location
+
+class Horse extends Animal
+ ###
+ @param name Horse name
+ @param jumper Jumping ability
+ ###
+ constructor: (name, jumper) ->
+ super name
+ @capable = jumper
+ step: ->
+ alert '''
+ Step,
+ step...
+ '''
+ jump: ->
+ @capable
+ move: (meters, where) ->
+ switch where
+ when "ground"
+ @step()
+ super meters
+ when "hurdle"
+ super meters if @jump()
+
+# Create horse
+tom = new Horse "Tommy", yes
+
+street =
+ location: "ground"
+ distance: 12
+car =
+ location: "hurdle"
+ distance: 2
+
+###
+Tell him to travel:
+1. through the street
+2. over the car
+###
+tom.travel street, car
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/css.txt b/test/prettify/PrettifyTest/source/css.txt
new file mode 100644
index 0000000..be19d0b
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/css.txt
@@ -0,0 +1,19 @@
+<!--
+@charset('UTF-8');
+
+/** A url that is not quoted. */
+@import(url(/more-styles.css));
+
+HTML { content-before: 'hello\20'; content-after: 'w\6f rld';
+ -moz-spiff: inherit !important }
+
+/* Test units on numbers. */
+BODY { margin-bottom: 4px; margin-left: 3in; margin-bottom: 0; margin-top: 5% }
+
+/** Test number literals and quoted values. */
+TABLE.foo TR.bar A#visited { color: #001123; font-family: "monospace" }
+/** bolder is not a name, so should be plain. !IMPORTANT is a keyword
+ * regardless of case.
+ */
+blink { text-decoration: BLINK !IMPORTANT; font-weight: bolder }
+-->
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/go.txt b/test/prettify/PrettifyTest/source/go.txt
new file mode 100644
index 0000000..7fe63b2
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/go.txt
@@ -0,0 +1,11 @@
+package main /* Package of which this program is part. */
+
+import fmt "fmt" // Package implementing formatted I/O.
+
+
+func main() {
+ fmt.Printf("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n") // Semicolon inserted here
+}
+
+/* " */ "foo /* " /*/ */
+/* ` */ `foo /* ` /*/ */
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/html.txt b/test/prettify/PrettifyTest/source/html.txt
new file mode 100644
index 0000000..aac4627
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/html.txt
@@ -0,0 +1,38 @@
+<html>
+ <head>
+ <title>Fibonacci number</title>
+ <style><!-- BODY { text-decoration: blink } --></style>
+ <script src="foo.js"></script>
+ <script src="bar.js"></script>
+ </head>
+ <body>
+ <noscript>
+ <dl>
+ <dt>Fibonacci numbers</dt>
+ <dd>1</dd>
+ <dd>1</dd>
+ <dd>2</dd>
+ <dd>3</dd>
+ <dd>5</dd>
+ <dd>8</dd>
+ …
+ </dl>
+ </noscript>
+
+ <script type="text/javascript"><!--
+function fib(n) {
+ var a = 1, b = 1;
+ var tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+document.writeln(fib(10));
+// -->
+ </script>
+ </body>
+</html>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/htmlXmp.txt b/test/prettify/PrettifyTest/source/htmlXmp.txt
new file mode 100644
index 0000000..26402d1
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/htmlXmp.txt
@@ -0,0 +1,35 @@
+<html>
+ <head>
+ <title>Fibonacci number</title>
+ </head>
+ <body>
+ <noscript>
+ <dl>
+ <dt>Fibonacci numbers</dt>
+ <dd>1</dd>
+ <dd>1</dd>
+ <dd>2</dd>
+ <dd>3</dd>
+ <dd>5</dd>
+ <dd>8</dd>
+ …
+ </dl>
+ </noscript>
+
+ <script type="text/javascript"><!--
+function fib(n) {
+ var a = 1, b = 1;
+ var tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+document.writeln(fib(10));
+// -->
+ </script>
+ </body>
+</html>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/html_lang.txt b/test/prettify/PrettifyTest/source/html_lang.txt
new file mode 100644
index 0000000..987efec
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/html_lang.txt
@@ -0,0 +1,30 @@
+Fibonacci Numbers
+
+<noscript>
+ <dl style="list-style: disc">
+ <dt>Fibonacci numbers</dt>
+ <dd>1</dd>
+ <dd>1</dd>
+ <dd>2</dd>
+ <dd>3</dd>
+ <dd>5</dd>
+ <dd>8</dd>
+ …
+ </dl>
+</noscript>
+
+<script type="text/javascript"><!--
+function fib(n) {
+ var a = 1, b = 1;
+ var tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+document.writeln(fib(10));
+// -->
+</script>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue12.txt b/test/prettify/PrettifyTest/source/issue12.txt
new file mode 100644
index 0000000..19e214e
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue12.txt
@@ -0,0 +1,40 @@
+/foo/; // a slash starting a line treated as a regexp beginning
+"foo".match(/fo+$/);
+// this line comment not treated as a regular expressions
+"foo /bar/".test(/"baz"/); // test string and regexp boundaries
+var division = /\b\d+\/\d+/g; // test char sets and escaping of specials
+var allSpecials = /([^\(\)\[\]\{\}\-\?\+\*\.\^\$\/]+)\\/;
+var slashInCharset = /[^/]/g, notCloseSq = /[^\]]/;
+
+// test that slash used in numeric context treated as an operator
+1 / 2;
+1. / x;
+x / y;
+(x) / y;
+1 /* foo */ / 2;
+1 /* foo *// 2;
+1/2;
+1./x;
+x/y;
+(x)/y;
+
+// test split over two lines. line comment should not fool it
+1//
+/2;
+
+x++/y;
+x--/y;
+x[y] / z;
+f() / n;
+
+// test that slash after non postfix operator is start of regexp
+log('matches = ' + /foo/.test(foo));
+
+// test keyword preceders
+return /a regexp/;
+division = notreturn / not_a_regexp / 2; // keyword suffix does not match
+
+// & not used as prefix operator in javascript but this should still work
+&/foo/;
+
+extends = /extends/;
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue12_lang.txt b/test/prettify/PrettifyTest/source/issue12_lang.txt
new file mode 100644
index 0000000..19e214e
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue12_lang.txt
@@ -0,0 +1,40 @@
+/foo/; // a slash starting a line treated as a regexp beginning
+"foo".match(/fo+$/);
+// this line comment not treated as a regular expressions
+"foo /bar/".test(/"baz"/); // test string and regexp boundaries
+var division = /\b\d+\/\d+/g; // test char sets and escaping of specials
+var allSpecials = /([^\(\)\[\]\{\}\-\?\+\*\.\^\$\/]+)\\/;
+var slashInCharset = /[^/]/g, notCloseSq = /[^\]]/;
+
+// test that slash used in numeric context treated as an operator
+1 / 2;
+1. / x;
+x / y;
+(x) / y;
+1 /* foo */ / 2;
+1 /* foo *// 2;
+1/2;
+1./x;
+x/y;
+(x)/y;
+
+// test split over two lines. line comment should not fool it
+1//
+/2;
+
+x++/y;
+x--/y;
+x[y] / z;
+f() / n;
+
+// test that slash after non postfix operator is start of regexp
+log('matches = ' + /foo/.test(foo));
+
+// test keyword preceders
+return /a regexp/;
+division = notreturn / not_a_regexp / 2; // keyword suffix does not match
+
+// & not used as prefix operator in javascript but this should still work
+&/foo/;
+
+extends = /extends/;
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue14a.txt b/test/prettify/PrettifyTest/source/issue14a.txt
new file mode 100644
index 0000000..fbf1b37
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue14a.txt
@@ -0,0 +1,3 @@
+//comment
+int main(int argc, char **argv)
+{}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue14b.txt b/test/prettify/PrettifyTest/source/issue14b.txt
new file mode 100644
index 0000000..e5b23c3
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue14b.txt
@@ -0,0 +1,2 @@
+<!-- There's an HTML comment in my comment -->
+<p>And another one inside the end tag</p>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue20.txt b/test/prettify/PrettifyTest/source/issue20.txt
new file mode 100644
index 0000000..a531038
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue20.txt
@@ -0,0 +1,3 @@
+<html>
+
+<head>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue21.txt b/test/prettify/PrettifyTest/source/issue21.txt
new file mode 100644
index 0000000..dd3551a
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue21.txt
@@ -0,0 +1,5 @@
+<html>
+ <head>
+ <title>Test</title>
+ </head>
+</html>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue24.txt b/test/prettify/PrettifyTest/source/issue24.txt
new file mode 100644
index 0000000..a57ff46
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue24.txt
@@ -0,0 +1,51 @@
+os=require("os")
+math=require("math")
+
+-- Examples from the language reference
+ a = 'alo\n123"'
+ a = "alo\n123\""
+ a = '\97lo\10\04923"'
+ a = [[alo
+ 123"]]
+ a = [==[
+ alo
+ 123"]==]
+
+3 3.0 3.1416 314.16e-2 0.31416E1 0xff 0x56
+
+-- Some comments that demonstrate long brackets
+double_quoted = "Not a long bracket [=["
+--[=[ quoting out
+ [[ foo ]]
+ [==[does not end comment either]==]
+]=]
+past_end_of_comment
+--]=]
+
+-- Example code courtesy Joseph Harmbruster
+#
+do
+ local function ssgeneral(t, n, before)
+ for _, h in ipairs(incs) do
+ for i = h + 1, n do
+ local v = t[i]
+ for j = i - h, 1, -h do
+ local testval = t[j]
+ if not before(v, testval) then break end
+ t[i] = testval; i = j
+ end
+ t[i] = v
+ end
+ end
+ return t
+ end
+
+ function shellsort(t, before, n)
+ n = n or #t
+ if not before or before == "<" then return ssup(t, n)
+ elseif before == ">" then return ssdown(t, n)
+ else return ssgeneral(t, n, before)
+ end
+ end
+ return shellsort
+end
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue27.txt b/test/prettify/PrettifyTest/source/issue27.txt
new file mode 100644
index 0000000..5e251e2
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue27.txt
@@ -0,0 +1,43 @@
+Imports System
+
+Class [class]
+ Shared Sub [shared](ByVal [boolean] As Boolean)
+ If [boolean] Then
+ Console.WriteLine("true")
+ Else
+ Console.WriteLine("false")
+ End If
+ End Sub
+End Class
+
+Module [module]
+ Sub Main()
+ [class].[shared](True)
+
+ ' This prints out: ".
+ Console.WriteLine("""")
+
+ ' This prints out: a"b.
+ Console.WriteLine("a""b")
+
+ ' This prints out: a.
+ Console.WriteLine("a"c)
+
+ ' This prints out: ".
+ Console.WriteLine(""""c)
+ End Sub
+End Module
+
+Dim d As Date
+d = # 8/23/1970 3:45:39AM #
+d = # 8/23/1970 #
+d = # 3:45:39AM #
+d = # 3:45:39 #
+d = # 13:45:39 #
+d = # 13:45:39PM #
+
+Dim n As Float
+n = (0.0, .99F, 1.0E-2D, 1.0E+3D, .5E4, 1E3R, 4D)
+
+Dim i As Integer
+i = (0, 123, 45L, &HA0I, &O177S)
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue30.txt b/test/prettify/PrettifyTest/source/issue30.txt
new file mode 100644
index 0000000..b37d4ac
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue30.txt
@@ -0,0 +1,26 @@
+-- A comment
+Not(--"a comment")
+Also.not(--(A.comment))
+
+module Foo(bar) where
+import Blah
+import BlahBlah(blah)
+import Monads(Exception(..), FIO(..),unFIO,handle,runFIO,fixFIO,fio,
+ write,writeln,HasNext(..),HasOutput(..))
+
+{- nested comments
+ - don't work {-yet-} -}
+instance Thingy Foo where
+ a = b
+
+data Foo :: (* -> * -> *) -> * > * -> * where
+ Nil :: Foo a b c
+ Cons :: a b c -> Foo abc -> Foo a b c
+
+str = "Foo\\Bar"
+char = 'x'
+Not.A.Char = 'too long' -- Don't barf. Show that 't is a lexical error.
+
+(ident, ident', Fo''o.b'ar)
+
+(0, 12, 0x45, 0xA7, 0o177, 0O377, 0.1, 1.0, 1e3, 0.5E-3, 1.0E+45)
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue33.txt b/test/prettify/PrettifyTest/source/issue33.txt
new file mode 100644
index 0000000..f079526
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue33.txt
@@ -0,0 +1,19 @@
+(*
+ * Print the 10th fibonacci number
+ *)
+
+//// A line comment
+"A string";;
+(0, 125, 0xa0, -1.0, 1e6, 1.2e-3);; // number literals
+
+#if fibby
+ let
+ rec fib = function (0, a, _) -> a
+ | (n, a, b) -> fib(n - 1, a + b, a)
+ in
+ print_int(fib(10, 1, 1));;
+#endif
+
+let zed = 'z'
+
+let f' x' = x' + 1
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue4.txt b/test/prettify/PrettifyTest/source/issue4.txt
new file mode 100644
index 0000000..f0027f1
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue4.txt
@@ -0,0 +1,10 @@
+<script type="text/javascript">
+ var savedTarget=null; // The target layer (effectively vidPane)
+ var orgCursor=null; // The original mouse style so we can restore it
+ var dragOK=false; // True if we're allowed to move the element under mouse
+ var dragXoffset=0; // How much we've moved the element on the horozontal
+ var dragYoffset=0; // How much we've moved the element on the verticle
+ vidPaneID = document.getElementById('vidPane'); // Our movable layer
+ vidPaneID.style.top='75px'; // Starting location horozontal
+ vidPaneID.style.left='75px'; // Starting location verticle
+<script>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue42.txt b/test/prettify/PrettifyTest/source/issue42.txt
new file mode 100644
index 0000000..9289c3e
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue42.txt
@@ -0,0 +1,39 @@
+; -*- mode: lisp -*-
+
+(defun back-six-lines () (interactive) (forward-line -6))
+(defun forward-six-lines () (interactive) (forward-line 6))
+
+(global-set-key "\M-l" 'goto-line)
+(global-set-key "\C-z" 'advertised-undo)
+(global-set-key [C-insert] 'clipboard-kill-ring-save)
+(global-set-key [S-insert] 'clipboard-yank)
+(global-set-key [C-up] 'back-six-lines)
+(global-set-key [C-down] 'forward-six-lines)
+
+(setq visible-bell t)
+(setq user-mail-address "foo@bar.com")
+(setq default-major-mode 'text-mode)
+
+(setenv "TERM" "emacs")
+(c-set-offset 'case-label 2)
+(setq c-basic-offset 2)
+(setq perl-indent-level 0x2)
+(setq delete-key-deletes-forward t)
+(setq indent-tabs-mode nil)
+
+;; Text mode
+(add-hook 'text-mode-hook
+ '(lambda ()
+ (turn-on-auto-fill)
+ )
+)
+
+;; Fundamental mode
+(add-hook 'fundamental-mode-hook
+ '(lambda ()
+ (turn-on-auto-fill)
+ )
+)
+
+;; Define and cond are keywords in scheme
+(define (sqt x) (sqrt-iter 1.0 2.0 x))
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue79.txt b/test/prettify/PrettifyTest/source/issue79.txt
new file mode 100644
index 0000000..0fe82bc
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue79.txt
@@ -0,0 +1,16 @@
+<style type='text/css'>
+/* desert scheme ported from vim to google prettify */
+code.prettyprint { display: block; padding: 2px; border: 1px solid #888;
+background-color: #333; }
+.str { color: #ffa0a0; } /* string - pink */
+.kwd { color: #f0e68c; font-weight: bold; }
+.com { color: #87ceeb; } /* comment - skyblue */
+.typ { color: #98fb98; } /* type - lightgreen */
+.lit { color: #cd5c5c; } /* literal - darkred */
+.pun { color: #fff; } /* punctuation */
+.pln { color: #fff; } /* plaintext */
+.tag { color: #f0e68c; font-weight: bold; } /* html/xml tag - lightyellow*/
+.atn { color: #bdb76b; font-weight: bold; } /* attribute name - khaki*/
+.atv { color: #ffa0a0; } /* attribute value - pink */
+.dec { color: #98fb98; } /* decimal - lightgreen */
+</style>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue8.txt b/test/prettify/PrettifyTest/source/issue8.txt
new file mode 100644
index 0000000..5892e73
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue8.txt
@@ -0,0 +1,3 @@
+one Two three Four five |
+Six seven Eight nine Ten |
+eleven Twelve thirteen Fourteen fifteen |
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue84.txt b/test/prettify/PrettifyTest/source/issue84.txt
new file mode 100644
index 0000000..4994711
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue84.txt
@@ -0,0 +1 @@
+super(" ");
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue92.txt b/test/prettify/PrettifyTest/source/issue92.txt
new file mode 100644
index 0000000..2e56ccb
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue92.txt
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Placemark>
+ <name>Simple placemark</name>
+ <description Lang="en">Attached to the ground. Intelligently places itself
+ at the height of the underlying terrain.</description>
+ <Point>
+ <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
+ </Point>
+ </Placemark>
+</kml>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/issue93.txt b/test/prettify/PrettifyTest/source/issue93.txt
new file mode 100644
index 0000000..bebad94
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/issue93.txt
@@ -0,0 +1,4 @@
+// The normal string syntax
+string a = "C:\\";
+// is equivalent to a verbatim string
+string b = @"C:\";
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/isue45.txt b/test/prettify/PrettifyTest/source/isue45.txt
new file mode 100644
index 0000000..44624b6
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/isue45.txt
@@ -0,0 +1,3 @@
+throw new RuntimeException("Element [" + element.getName() +
+ "] missing attribute.");
+variable++;
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/java.txt b/test/prettify/PrettifyTest/source/java.txt
new file mode 100644
index 0000000..daab483
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/java.txt
@@ -0,0 +1,44 @@
+package foo;
+
+import java.util.Iterator;
+
+/**
+ * the fibonacci series implemented as an Iterable.
+ */
+public final class Fibonacci implements Iterable<Integer> {
+ /** the next and previous members of the series. */
+ private int a = 1, b = 1;
+
+ @Override
+ public Iterator<Integer> iterator() {
+ return new Iterator<Integer>() {
+ /** the series is infinite. */
+ public boolean hasNext() { return true; }
+ public Integer next() {
+ int tmp = a;
+ a += b;
+ b = tmp;
+ return a;
+ }
+ public void remove() { throw new UnsupportedOperationException(); }
+ };
+ }
+
+ /**
+ * the n<sup>th</sup> element of the given series.
+ * @throws NoSuchElementException if there are less than n elements in the
+ * given Iterable's {@link Iterable#iterator iterator}.
+ */
+ public static <T>
+ T nth(int n, Iterable<T> iterable) {
+ Iterator<? extends T> it = iterable.iterator();
+ while (--n > 0) {
+ it.next();
+ }
+ return it.next();
+ }
+
+ public static void main(String[] args) {
+ System.out.print(nth(10, new Fibonacci()));
+ }
+}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/java_lang.txt b/test/prettify/PrettifyTest/source/java_lang.txt
new file mode 100644
index 0000000..844443b
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/java_lang.txt
@@ -0,0 +1,47 @@
+package foo;
+
+import java.util.Iterator;
+
+/**
+ * the fibonacci series implemented as an Iterable.
+ */
+public final class Fibonacci implements Iterable<Integer> {
+ /** the next and previous members of the series. */
+ private int a = 1, b = 1;
+
+ @Override
+ public Iterator<Integer> iterator() {
+ return new Iterator<Integer>() {
+ /** the series is infinite. */
+ public boolean hasNext() { return true; }
+ public Integer next() {
+ int tmp = a;
+ a += b;
+ b = tmp;
+ return a;
+ }
+ public void remove() { throw new UnsupportedOperationException(); }
+ };
+ }
+
+ /**
+ * the n<sup>th</sup> element of the given series.
+ * @throws NoSuchElementException if there are less than n elements in the
+ * given Iterable's {@link Iterable#iterator iterator}.
+ */
+ public static <T>
+ T nth(int n, Iterable<T> iterable) {
+ Iterator<? extends T> in = iterable.iterator();
+ while (--n > 0) {
+ in.next();
+ }
+ return in.next();
+ }
+
+ public static void main(String[] args) {
+ System.out.print(nth(10, new Fibonacci()));
+ }
+}
+
+# not a java comment
+# not keywords: static_cast and namespace
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/javascript.txt b/test/prettify/PrettifyTest/source/javascript.txt
new file mode 100644
index 0000000..3bc54e3
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/javascript.txt
@@ -0,0 +1,17 @@
+/**
+ * nth element in the fibonacci series.
+ * @param n >= 0
+ * @return the nth element, >= 0.
+ */
+function fib(n) {
+ var a = 1, b = 1;
+ var tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+
+document.write(fib(10));
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/misc1.txt b/test/prettify/PrettifyTest/source/misc1.txt
new file mode 100644
index 0000000..6f3a3ba
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/misc1.txt
@@ -0,0 +1,2 @@
+// ends with line comment token
+//
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/perl.txt b/test/prettify/PrettifyTest/source/perl.txt
new file mode 100644
index 0000000..a9ed533
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/perl.txt
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+use strict;
+use integer;
+
+# the nth element of the fibonacci series
+# param n - an int >= 0
+# return an int >= 0
+sub fib($) {
+ my $n = shift, $a = 1, $b = 1;
+ ($a, $b) = ($a + $b, $a) until (--$n < 0);
+ return $a;
+}
+
+print fib(10);
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/proto.txt b/test/prettify/PrettifyTest/source/proto.txt
new file mode 100644
index 0000000..ff97de5
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/proto.txt
@@ -0,0 +1,15 @@
+message SearchRequest {
+ required string query = 1;
+ optional int32 page_number = 2;
+ optional int32 result_per_page = 3 [default = 10];
+ enum Corpus {
+ UNIVERSAL = 0;
+ WEB = 1;
+ IMAGES = 2;
+ LOCAL = 3;
+ NEWS = 4;
+ PRODUCTS = 5;
+ VIDEO = 6;
+ }
+ optional Corpus corpus = 4 [default = UNIVERSAL];
+}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/python.txt b/test/prettify/PrettifyTest/source/python.txt
new file mode 100644
index 0000000..6cc14aa
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/python.txt
@@ -0,0 +1,24 @@
+#!/usr/bin/python2.4
+
+def fib():
+ '''
+ a generator that produces the elements of the fibonacci series
+ '''
+
+ a = 1
+ b = 1
+ while True:
+ a, b = a + b, a
+ yield a
+
+def nth(series, n):
+ '''
+ returns the nth element of a series,
+ consuming the earlier elements of the series
+ '''
+
+ for x in series:
+ n = n - 1
+ if n <= 0: return x
+
+print nth(fib(), 10)
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/python_lang.txt b/test/prettify/PrettifyTest/source/python_lang.txt
new file mode 100644
index 0000000..982efaf
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/python_lang.txt
@@ -0,0 +1,26 @@
+#!/usr/bin/python2.4
+
+def fib():
+ '''
+ a generator that produces the fibonacci series's elements
+ '''
+
+ a = 1
+ b = 1
+ while True:
+ a, b = a + b, a
+ yield a
+
+def nth(series, n):
+ '''
+ returns the nth element of a series,
+ consuming the series' earlier elements.
+ '''
+
+ for x in series:
+ n -= 1
+ if n <= 0: return x
+
+print nth(fib(), 10)
+
+/* not a comment and not keywords: null char true */
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/scala.txt b/test/prettify/PrettifyTest/source/scala.txt
new file mode 100644
index 0000000..df3bbca
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/scala.txt
@@ -0,0 +1,55 @@
+/* comment 1 */
+/*
+comment 2
+*/
+/* comment / * comment 3 **/
+// strings
+"Hello, World!", "\n",
+`an-identifier`, `\n`,
+'A', '\n',
+'aSymbol,
+"""Hello,
+World""", """Hello,\nWorld""",
+"""Hello, "World"!""",
+"""Hello, \"World\""""
+
+// Numbers
+0
+0123
+0xa0
+0XA0L
+123
+123.45
+1.50F
+0.50
+.50
+123e-1
+123.45e+1
+1.50e2
+0.50e-6
+.50e+42f
+
+// Values
+false, true, null, this;
+
+// Keywords
+class MyClass;
+import foo.bar;
+package baz;
+
+// From scala-lang.org/node/242
+def act() {
+ var pongCount = 0
+ loop {
+ react {
+ case Ping =>
+ if (pongCount % 1000 == 0)
+ Console.println("Pong: ping "+pongCount)
+ sender ! Pong
+ pongCount = pongCount + 1
+ case Stop =>
+ Console.println("Pong: stop")
+ exit()
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/sql_lang.txt b/test/prettify/PrettifyTest/source/sql_lang.txt
new file mode 100644
index 0000000..6205558
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/sql_lang.txt
@@ -0,0 +1,9 @@
+/* A multi-line
+ * comment */
+'Another string /* Isn\'t a comment',
+"A string */"
+-- A line comment
+SELECT * FROM users WHERE id IN (1, 2.0, +30e-1);
+-- keywords are case-insensitive.
+-- Note: user-table is a single identifier, not a pair of keywords
+select * from user-table where id in (x, y, z);
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/vhdl.txt b/test/prettify/PrettifyTest/source/vhdl.txt
new file mode 100644
index 0000000..b3e9dee
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/vhdl.txt
@@ -0,0 +1,36 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+-- A line comment
+entity foo_entity is
+
+ generic (-- comment after punc
+ a : natural := 42;
+ x : real := 16#ab.cd#-3
+ );
+ port (
+ clk_i : in std_logic;
+ b_i : in natural range 0 to 100;
+ c_o : out std_logic_vector(5 downto 0);
+ \a "name"\ : out integer -- extended identifier
+ );
+
+end entity foo_entity;
+
+architecture foo_architecture of foo_entity is
+ signal bar_s : std_logic_vector(2 downto 0);
+begin
+
+ bar_s <= b"101";
+
+ dummy_p : process (clk_i)
+ begin
+ if b_i = 1 then
+ c_o <= (others => '0');
+ elsif rising_edge(clk_i) then
+ c_o <= "1011" & bar_s(1 downto 0);
+ end if;
+ end process dummy_p;
+
+end architecture foo_architecture;
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/wiki.txt b/test/prettify/PrettifyTest/source/wiki.txt
new file mode 100644
index 0000000..adcd7dd
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/wiki.txt
@@ -0,0 +1,23 @@
+#summary hello world
+#labels HelloWorld WikiWord Hiya
+
+[http://www.google.com/?q=WikiSyntax+site:code.google.com WikiSyntax]
+
+Lorem Ipsum `while (1) print("blah blah");`
+
+ * Bullet
+ * Points
+ * NestedBullet
+
+==DroningOnAndOn==
+{{{
+ // Some EmbeddedSourceCode
+ void main() {
+ Print('hello world');
+ }
+}}}
+
+{{{
+ <!-- Embedded XML -->
+ <foo bar="baz"><boo /><foo>
+}}}
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/xhtml.txt b/test/prettify/PrettifyTest/source/xhtml.txt
new file mode 100644
index 0000000..5d2c119
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/xhtml.txt
@@ -0,0 +1,20 @@
+<xhtml>
+ <head>
+ <title>Fibonacci number</title>
+ </head>
+ <body onload="alert(fib(10))">
+ <script type="text/javascript"><![CDATA[
+function fib(n) {
+ var a = 1, b = 1;
+ var tmp;
+ while (--n >= 0) {
+ tmp = a;
+ a += b;
+ b = tmp;
+ }
+ return a;
+}
+]]>
+ </script>
+ </body>
+</xhtml>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/xml.txt b/test/prettify/PrettifyTest/source/xml.txt
new file mode 100644
index 0000000..5c7ec82
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/xml.txt
@@ -0,0 +1,11 @@
+<!DOCTYPE series PUBLIC "fibonacci numbers">
+
+<series.root base="1" step="s(n-2) + s(n-1)">
+ <element i="0">1</element>
+ <element i="1">1</element>
+ <element i="2">2</element>
+ <element i="3">3</element>
+ <element i="4">5</element>
+ <element i="5">8</element>
+ ...
+</series.root>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/xsl.txt b/test/prettify/PrettifyTest/source/xsl.txt
new file mode 100644
index 0000000..d5a45c5
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/xsl.txt
@@ -0,0 +1,7 @@
+<!-- Test elements and attributes with namespaces -->
+
+<xsl:stylesheet xml:lang="en">
+ <xsl:template match=".">
+ <xsl:text>Hello World</xsl:text>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/yaml1.txt b/test/prettify/PrettifyTest/source/yaml1.txt
new file mode 100644
index 0000000..52e0fe5
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/yaml1.txt
@@ -0,0 +1,24 @@
+application: mirah-lang
+version: 1
+
+# Here's a comment
+handlers:
+ - url: /red/*
+ servlet: mysite.server.TeamServlet
+ init_params:
+ teamColor: red
+ bgColor: "#CC0000"
+ name: redteam
+ - url: /blue/*
+ servlet: mysite.server.TeamServlet
+ init_params:
+ teamColor: blue
+ bgColor: "#0000CC"
+ name: blueteam
+ - url: /register/*
+ jsp: /register/start.jsp
+ - url: *.special
+ filter: mysite.server.LogFilterImpl
+ init_params:
+ logType: special
+
\ No newline at end of file
diff --git a/test/prettify/PrettifyTest/source/yaml2.txt b/test/prettify/PrettifyTest/source/yaml2.txt
new file mode 100644
index 0000000..9e2d716
--- /dev/null
+++ b/test/prettify/PrettifyTest/source/yaml2.txt
@@ -0,0 +1,16 @@
+%YAML 1.1
+---
+!!map {
+ ? !!str ""
+ : !!str "value",
+ ? !!str "explicit key"
+ : !!str "value",
+ ? !!str "simple key"
+ : !!str "value",
+ ? !!seq [
+ !!str "collection",
+ !!str "simple",
+ !!str "key"
+ ]
+ : !!str "value"
+}
\ No newline at end of file