aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉamonn McManus <emcmanus@google.com>2018-05-29 15:51:17 -0700
committerGitHub <noreply@github.com>2018-05-29 15:51:17 -0700
commitaba931ce8c8fc6edcdf128edea0c443d7e968f4f (patch)
tree0aef544a0567137907e3561b201f3ce394acc6fc
parent89ea4ddf7f3d0005543fb740481eeb0dc5cddac9 (diff)
parentcacaaa72d86d40b10cecec4fcfa58792ee6b6a10 (diff)
downloadescapevelocity-aba931ce8c8fc6edcdf128edea0c443d7e968f4f.tar.gz
Merge pull request #1 from google/sync-2018-05-29
Sync with Google-internal copy.
-rw-r--r--README.md38
-rw-r--r--src/main/java/com/google/escapevelocity/ConstantExpressionNode.java35
-rw-r--r--src/main/java/com/google/escapevelocity/DirectiveNode.java35
-rw-r--r--src/main/java/com/google/escapevelocity/EvaluationContext.java35
-rw-r--r--src/main/java/com/google/escapevelocity/EvaluationException.java35
-rw-r--r--src/main/java/com/google/escapevelocity/ExpressionNode.java35
-rw-r--r--src/main/java/com/google/escapevelocity/ImmutableAsciiSet.java100
-rw-r--r--src/main/java/com/google/escapevelocity/ImmutableList.java93
-rw-r--r--src/main/java/com/google/escapevelocity/ImmutableSet.java58
-rw-r--r--src/main/java/com/google/escapevelocity/Macro.java35
-rw-r--r--src/main/java/com/google/escapevelocity/Node.java35
-rw-r--r--src/main/java/com/google/escapevelocity/ParseException.java35
-rw-r--r--src/main/java/com/google/escapevelocity/Parser.java35
-rw-r--r--src/main/java/com/google/escapevelocity/README.md378
-rw-r--r--src/main/java/com/google/escapevelocity/ReferenceNode.java35
-rw-r--r--src/main/java/com/google/escapevelocity/Reparser.java35
-rw-r--r--src/main/java/com/google/escapevelocity/Template.java35
-rw-r--r--src/main/java/com/google/escapevelocity/TokenNode.java35
-rw-r--r--src/test/java/com/google/escapevelocity/ImmutableSetTest.java43
-rw-r--r--src/test/java/com/google/escapevelocity/ReferenceNodeTest.java16
-rw-r--r--src/test/java/com/google/escapevelocity/TemplateTest.java16
21 files changed, 173 insertions, 1024 deletions
diff --git a/README.md b/README.md
index 839c002..0f24bc5 100644
--- a/README.md
+++ b/README.md
@@ -311,6 +311,44 @@ Macros can make templates hard to understand. You may prefer to put the logic in
rather than a macro, and call the method from the template using `$methods.doSomething("foo")`
or whatever.
+## Block quoting
+
+If you have text that should be treated verbatim, you can enclose it in `#[[...]]#`. The text
+represented by `...` will be copied into the output. `#` and `$` characters will have no
+effect in that text.
+
+```
+#[[ This is not a #directive, and this is not a $variable. ]]#
+```
+
+## Including other templates
+
+If you want to include a template from another file, you can use the `#parse` directive.
+This can be useful if you have macros that are shared between templates, for example.
+
+```
+#set ($foo = "bar")
+#parse("macros.vm")
+#mymacro($foo) ## #mymacro defined in macros.vm
+```
+
+For this to work, you will need to tell EscapeVelocity how to find "resources" such as
+`macro.vm` in the example. You might use something like this:
+
+```
+ResourceOpener resourceOpener = resourceName -> {
+ InputStream inputStream = getClass().getResource(resourceName);
+ if (inputStream == null) {
+ throw new IOException("Unknown resource: " + resourceName);
+ }
+ return new BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8));
+};
+Template template = Template.parseFrom("foo.vm", resourceOpener);
+```
+
+In this case, the `resourceOpener` is used to find the main template `foo.vm`, as well as any
+templates it may reference in `#parse` directives.
+
## <a name="spaces"></a> Spaces
For the most part, spaces and newlines in the template are preserved exactly in the output.
diff --git a/src/main/java/com/google/escapevelocity/ConstantExpressionNode.java b/src/main/java/com/google/escapevelocity/ConstantExpressionNode.java
index 982a4a9..50fc9bc 100644
--- a/src/main/java/com/google/escapevelocity/ConstantExpressionNode.java
+++ b/src/main/java/com/google/escapevelocity/ConstantExpressionNode.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/DirectiveNode.java b/src/main/java/com/google/escapevelocity/DirectiveNode.java
index db6a3a3..2d4decc 100644
--- a/src/main/java/com/google/escapevelocity/DirectiveNode.java
+++ b/src/main/java/com/google/escapevelocity/DirectiveNode.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/EvaluationContext.java b/src/main/java/com/google/escapevelocity/EvaluationContext.java
index 4c4b27d..d2f2914 100644
--- a/src/main/java/com/google/escapevelocity/EvaluationContext.java
+++ b/src/main/java/com/google/escapevelocity/EvaluationContext.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/EvaluationException.java b/src/main/java/com/google/escapevelocity/EvaluationException.java
index c64318c..2457d0a 100644
--- a/src/main/java/com/google/escapevelocity/EvaluationException.java
+++ b/src/main/java/com/google/escapevelocity/EvaluationException.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/ExpressionNode.java b/src/main/java/com/google/escapevelocity/ExpressionNode.java
index e666ed1..281e998 100644
--- a/src/main/java/com/google/escapevelocity/ExpressionNode.java
+++ b/src/main/java/com/google/escapevelocity/ExpressionNode.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/ImmutableAsciiSet.java b/src/main/java/com/google/escapevelocity/ImmutableAsciiSet.java
deleted file mode 100644
index 96a126c..0000000
--- a/src/main/java/com/google/escapevelocity/ImmutableAsciiSet.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.google.escapevelocity;
-
-import java.util.AbstractSet;
-import java.util.BitSet;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * An immutable set of ASCII characters.
- *
- * @author emcmanus@google.com (Éamonn McManus)
- */
-class ImmutableAsciiSet extends AbstractSet<Integer> {
- private final BitSet bits;
-
- ImmutableAsciiSet(BitSet bits) {
- this.bits = bits;
- }
-
- static ImmutableAsciiSet of(char c) {
- return ofRange(c, c);
- }
-
- static ImmutableAsciiSet ofRange(char from, char to) {
- if (from > to) {
- throw new IllegalArgumentException("from > to");
- }
- if (to >= 128) {
- throw new IllegalArgumentException("Not ASCII");
- }
- BitSet bits = new BitSet();
- bits.set(from, to + 1);
- return new ImmutableAsciiSet(bits);
- }
-
- ImmutableAsciiSet union(ImmutableAsciiSet that) {
- BitSet union = (BitSet) bits.clone();
- union.or(that.bits);
- return new ImmutableAsciiSet(union);
- }
-
- @Override
- public boolean contains(Object o) {
- int i = -1;
- if (o instanceof Character) {
- i = (Character) o;
- } else if (o instanceof Integer) {
- i = (Integer) o;
- }
- return contains(i);
- }
-
- boolean contains(int i) {
- if (i < 0) {
- return false;
- } else {
- return bits.get(i);
- }
- }
-
- @Override
- public Iterator<Integer> iterator() {
- return new Iterator<Integer>() {
- private int index;
-
- @Override
- public boolean hasNext() {
- return bits.nextSetBit(index) >= 0;
- }
-
- @Override
- public Integer next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- int next = bits.nextSetBit(index);
- index = next + 1;
- return next;
- }
- };
- }
-
- @Override
- public int size() {
- return bits.cardinality();
- }
-}
diff --git a/src/main/java/com/google/escapevelocity/ImmutableList.java b/src/main/java/com/google/escapevelocity/ImmutableList.java
deleted file mode 100644
index 0b903f7..0000000
--- a/src/main/java/com/google/escapevelocity/ImmutableList.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.google.escapevelocity;
-
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * An immutable list.
- *
- * @author emcmanus@google.com (Éamonn McManus)
- */
-class ImmutableList<E> extends AbstractList<E> {
- private static final ImmutableList<?> EMPTY = new ImmutableList<>(new Object[0]);
-
- private final E[] elements;
-
- private ImmutableList(E[] elements) {
- this.elements = elements;
- }
-
- @Override
- public Iterator<E> iterator() {
- return Arrays.asList(elements).iterator();
- }
-
- @Override
- public E get(int index) {
- if (index < 0 || index >= elements.length) {
- throw new IndexOutOfBoundsException(String.valueOf(index));
- }
- return elements[index];
- }
-
- @Override
- public int size() {
- return elements.length;
- }
-
- static <E> ImmutableList<E> of() {
- @SuppressWarnings("unchecked")
- ImmutableList<E> empty = (ImmutableList<E>) EMPTY;
- return empty;
- }
-
- @SafeVarargs
- static <E> ImmutableList<E> of(E... elements) {
- return new ImmutableList<>(elements.clone());
- }
-
- static <E> ImmutableList<E> copyOf(List<E> list) {
- @SuppressWarnings("unchecked")
- E[] elements = (E[]) new Object[list.size()];
- list.toArray(elements);
- return new ImmutableList<>(elements);
- }
-
- static <E> Builder<E> builder() {
- return new Builder<E>();
- }
-
- static class Builder<E> {
- private final List<E> list = new ArrayList<>();
-
- void add(E element) {
- list.add(element);
- }
-
- ImmutableList<E> build() {
- if (list.isEmpty()) {
- return ImmutableList.of();
- }
- @SuppressWarnings("unchecked")
- E[] elements = (E[]) new Object[list.size()];
- list.toArray(elements);
- return new ImmutableList<>(elements);
- }
- }
-}
diff --git a/src/main/java/com/google/escapevelocity/ImmutableSet.java b/src/main/java/com/google/escapevelocity/ImmutableSet.java
deleted file mode 100644
index f4e8e9f..0000000
--- a/src/main/java/com/google/escapevelocity/ImmutableSet.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.google.escapevelocity;
-
-import java.util.AbstractSet;
-import java.util.Arrays;
-import java.util.Iterator;
-
-/**
- * An immutable set. This implementation is only suitable for sets with a small number of elements.
- *
- * @author emcmanus@google.com (Éamonn McManus)
- */
-class ImmutableSet<E> extends AbstractSet<E> {
- private final E[] elements;
-
- private ImmutableSet(E[] elements) {
- this.elements = elements;
- }
-
- @Override
- public Iterator<E> iterator() {
- return Arrays.asList(elements).iterator();
- }
-
- @Override
- public int size() {
- return elements.length;
- }
-
- @SafeVarargs
- static <E> ImmutableSet<E> of(E... elements) {
- int len = elements.length;
- for (int i = 0; i < len - 1; i++) {
- for (int j = len - 1; j > i; j--) {
- if (elements[i].equals(elements[j])) {
- // We want to exclude elements[j] from the final set. We can do that by copying the
- // current last element in place of j (this might be j itself) and then reducing the
- // size of the set.
- elements[j] = elements[len - 1];
- len--;
- }
- }
- }
- return new ImmutableSet<>(Arrays.copyOf(elements, len));
- }
-}
diff --git a/src/main/java/com/google/escapevelocity/Macro.java b/src/main/java/com/google/escapevelocity/Macro.java
index fbb1764..b7a547f 100644
--- a/src/main/java/com/google/escapevelocity/Macro.java
+++ b/src/main/java/com/google/escapevelocity/Macro.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/Node.java b/src/main/java/com/google/escapevelocity/Node.java
index d11c95d..485f8a5 100644
--- a/src/main/java/com/google/escapevelocity/Node.java
+++ b/src/main/java/com/google/escapevelocity/Node.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/ParseException.java b/src/main/java/com/google/escapevelocity/ParseException.java
index 9d4a39c..7105f97 100644
--- a/src/main/java/com/google/escapevelocity/ParseException.java
+++ b/src/main/java/com/google/escapevelocity/ParseException.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/Parser.java b/src/main/java/com/google/escapevelocity/Parser.java
index 0beaf18..17c7fba 100644
--- a/src/main/java/com/google/escapevelocity/Parser.java
+++ b/src/main/java/com/google/escapevelocity/Parser.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/README.md b/src/main/java/com/google/escapevelocity/README.md
deleted file mode 100644
index 0e9ff1e..0000000
--- a/src/main/java/com/google/escapevelocity/README.md
+++ /dev/null
@@ -1,378 +0,0 @@
-# EscapeVelocity summary
-
-EscapeVelocity is a templating engine that can be used from Java. It is a reimplementation of a subset of
-functionality from [Apache Velocity](http://velocity.apache.org/).
-
-This is not a supported Google product.
-
-For a fuller explanation of Velocity's functioning, see its
-[User Guide](http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html)
-
-If EscapeVelocity successfully produces a result from a template evaluation, that result should be
-the exact same string that Velocity produces. If not, that is a bug.
-
-EscapeVelocity has no facilities for HTML escaping and it is not appropriate for producing
-HTML output that might include portions of untrusted input.
-
-## Motivation
-
-Velocity has a convenient templating language. It is easy to read, and it has widespread support
-from tools such as editors and coding websites. However, *using* Velocity can prove difficult.
-Its use to generate Java code in the [AutoValue][AutoValue] annotation processor required many
-[workarounds][VelocityHacks]. The way it dynamically loads classes as part of its standard operation
-makes it hard to [shade](https://maven.apache.org/plugins/maven-shade-plugin/) it, which in the case
-of AutoValue led to interference if Velocity was used elsewhere in a project.
-
-EscapeVelocity has a simple API that does not involve any class-loading or other sources of
-problems. It and its dependencies can be shaded with no difficulty.
-
-## Loading a template
-
-The entry point for EscapeVelocity is the `Template` class. To obtain an instance, use
-`Template.from(Reader)`. If a template is stored in a file, that file conventionally has the
-suffix `.vm` (for Velocity Macros). But since the argument is a `Reader`, you can also load
-a template directly from a Java string, using `StringReader`.
-
-Here's how you might make a `Template` instance from a template file that is packaged as a resource
-in the same package as the calling class:
-
-```java
-InputStream in = getClass().getResourceAsStream("foo.vm");
-if (in == null) {
- throw new IllegalArgumentException("Could not find resource foo.vm");
-}
-Reader reader = new BufferedReader(new InputStreamReader(in));
-Template template = Template.parseFrom(reader);
-```
-
-## Expanding a template
-
-Once you have a `Template` object, you can use it to produce a string where the variables in the
-template are given the values you provide. You can do this any number of times, specifying the
-same or different values each time.
-
-Suppose you have this template:
-
-```
-The $language word for $original is $translated.
-```
-
-You might write this code:
-
-```java
-Map<String, String> vars = new HashMap<>();
-vars.put("language", "French");
-vars.put("original", "toe");
-vars.put("translated", "orteil");
-String result = template.evaluate(vars);
-```
-
-The `result` string would then be: `The French word for toe is orteil.`
-
-## Comments
-
-The characters `##` introduce a comment. Characters from `##` up to and including the following
-newline are omitted from the template. This template has comments:
-
-```
-Line 1 ## with a comment
-Line 2
-```
-
-It is the same as this template:
-```
-Line 1 Line 2
-```
-
-## References
-
-EscapeVelocity supports most of the reference types described in the
-[Velocity User Guide](http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html#References)
-
-### Variables
-
-A variable has an ASCII name that starts with a letter (a-z or A-Z) and where any other characters
-are also letters or digits or hyphens (-) or underscores (_). A variable reference can be written
-as `$foo` or as `${foo}`. The value of a variable can be of any Java type. If the value `v` of
-variable `foo` is not a String then the result of `$foo` in a template will be `String.valueOf(v)`.
-Variables must be defined before they are referenced; otherwise an `EvaluationException` will be
-thrown.
-
-Variable names are case-sensitive: `$foo` is not the same variable as `$Foo` or `$FOO`.
-
-Initially the values of variables come from the Map that is passed to `Template.evaluate`. Those
-values can be changed, and new ones defined, using the `#set` directive in the template:
-
-```
-#set ($foo = "bar")
-```
-
-Setting a variable affects later references to it in the template, but has no effect on the
-`Map` that was passed in or on later template evaluations.
-
-### Properties
-
-If a reference looks like `$purchase.Total` then the value of the `$purchase` variable must be a
-Java object that has a public method `getTotal()` or `gettotal()`, or a method called `isTotal()` or
-`istotal()` that returns `boolean`. The result of `$purchase.Total` is then the result of calling
-that method on the `$purchase` object.
-
-If you want to have a period (`.`) after a variable reference *without* it being a property
-reference, you can use braces like this: `${purchase}.Total`. If, after a property reference, you
-have a further period, you can put braces around the reference like this:
-`${purchase.Total}.nonProperty`.
-
-### Methods
-
-If a reference looks like `$purchase.addItem("scones", 23)` then the value of the `$purchase`
-variable must be a Java object that has a public method `addItem` with two parameters that match
-the given values. Unlike Velocity, EscapeVelocity requires that there be exactly one such method.
-It is OK if there are other `addItem` methods provided they are not compatible with the
-arguments provided.
-
-Properties are in fact a special case of methods: instead of writing `$purchase.Total` you could
-write `$purchase.getTotal()`. Braces can be used to make the method invocation explicit
-(`${purchase.getTotal()}`) or to prevent method invocation (`${purchase}.getTotal()`).
-
-### Indexing
-
-If a reference looks like `$indexme[$i]` then the value of the `$indexme` variable must be a Java
-object that has a public `get` method that takes one argument that is compatible with the index.
-For example, `$indexme` might be a `List` and `$i` might be an integer. Then the reference would
-be the result of `List.get(int)` for that list and that integer. Or, `$indexme` might be a `Map`,
-and the reference would be the result of `Map.get(Object)` for the object `$i`. In general,
-`$indexme[$i]` is equivalent to `$indexme.get($i)`.
-
-Unlike Velocity, EscapeVelocity does not allow `$indexme` to be a Java array.
-
-### Undefined references
-
-If a variable has not been given a value, either by being in the initial Map argument or by being
-set in the template, then referencing it will provoke an `EvaluationException`. There is
-a special case for `#if`: if you write `#if ($var)` then it is allowed for `$var` not to be defined,
-and it is treated as false.
-
-### Setting properties and indexes: not supported
-
-Unlke Velocity, EscapeVelocity does not allow `#set` assignments with properties or indexes:
-
-```
-#set ($data.User = "jon") ## Allowed in Velocity but not in EscapeVelocity
-#set ($map["apple"] = "orange") ## Allowed in Velocity but not in EscapeVelocity
-```
-
-## Expressions
-
-In certain contexts, such as the `#set` directive we have just seen or certain other directives,
-EscapeVelocity can evaluate expressions. An expression can be any of these:
-
-* A reference, of the kind we have just seen. The value is the value of the reference.
-* A string literal enclosed in double quotes, like `"this"`. A string literal must appear on
- one line. EscapeVelocity does not support the characters `$` or `\\` in a string literal.
-* An integer literal such as `23` or `-100`. EscapeVelocity does not support floating-point
- literals.
-* A Boolean literal, `true` or `false`.
-* Simpler expressions joined together with operators that have the same meaning as in Java:
- `!`, `==`, `!=`, `<`, `<=`, `>`, `>=`, `&&`, `||`, `+`, `-`, `*`, `/`, `%`. The operators have the
- same precedence as in Java.
-* A simpler expression in parentheses, for example `(2 + 3)`.
-
-Velocity supports string literals with single quotes, like `'this`' and also references within
-strings, like `"a $reference in a string"`, but EscapeVelocity does not.
-
-## Directives
-
-A directive is introduced by a `#` character followed by a word. We have already seen the `#set`
-directive, which sets the value of a variable. The other directives are listed below.
-
-Directives can be spelled with or without braces, so `#set` or `#{set}`.
-
-### `#if`/`#elseif`/`#else`
-
-The `#if` directive selects parts of the template according as a condition is true or false.
-The simplest case looks like this:
-
-```
-#if ($condition) yes #end
-```
-
-This evaluates to the string ` yes ` if the variable `$condition` is defined and has a true value,
-and to the empty string otherwise. It is allowed for `$condition` not to be defined in this case,
-and then it is treated as false.
-
-The expression in `#if` (here `$condition`) is considered true if its value is not null and not
-equal to the Boolean value `false`.
-
-An `#if` directive can also have an `#else` part, for example:
-
-```
-#if ($condition) yes #else no #end
-```
-
-This evaluates to the string ` yes ` if the condition is true or the string ` no ` if it is not.
-
-An `#if` directive can have any number of `#elseif` parts. For example:
-
-```
-#if ($i == 0) zero #elseif ($i == 1) one #elseif ($i == 2) two #else many #end
-```
-
-### `#foreach`
-
-The `#foreach` directive repeats a part of the template once for each value in a list.
-
-```
-#foreach ($product in $allProducts)
- ${product}!
-#end
-```
-
-This will produce one line for each value in the `$allProducts` variable. The value of
-`$allProducts` can be a Java `Iterable`, such as a `List` or `Set`; or it can be an object array;
-or it can be a Java `Map`. When it is a `Map` the `#foreach` directive loops over every *value*
-in the `Map`.
-
-If `$allProducts` is a `List` containing the strings `oranges` and `lemons` then the result of the
-`#foreach` would be this:
-
-```
-
- oranges!
-
-
- lemons!
-
-```
-
-When the `#foreach` completes, the loop variable (`$product` in the example) goes back to whatever
-value it had before, or to being undefined if it was undefined before.
-
-Within the `#foreach`, a special variable `$foreach` is defined, such that you can write
-`$foreach.hasNext`, which will be true if there are more values after this one or false if this
-is the last value. For example:
-
-```
-#foreach ($product in $allProducts)${product}#if ($foreach.hasNext), #end#end
-```
-
-This would produce the output `oranges, lemons` for the list above. (The example is scrunched up
-to avoid introducing extraneous spaces, as described in the [section](#spaces) on spaces
-below.)
-
-Velocity gives the `$foreach` variable other properties (`index` and `count`) but EscapeVelocity
-does not.
-
-### Macros
-
-A macro is a part of the template that can be reused in more than one place, potentially with
-different parameters each time. In the simplest case, a macro has no arguments:
-
-```
-#macro (hello) bonjour #end
-```
-
-Then the macro can be referenced by writing `#hello()` and the result will be the string ` bonjour `
-inserted at that point.
-
-Macros can also have parameters:
-
-```
-#macro (greet $hello $world) $hello, $world! #end
-```
-
-Then `#greet("bonjour", "monde")` would produce ` bonjour, monde! `. The comma is optional, so
-you could also write `#greet("bonjour" "monde")`.
-
-When a macro completes, the parameters (`$hello` and `$world` in the example) go back to whatever
-values they had before, or to being undefined if they were undefined before.
-
-All macro definitions take effect before the template is evaluated, so you can use a macro at a
-point in the template that is before the point where it is defined. This also means that you can't
-define a macro conditionally:
-
-```
-## This doesn't work!
-#if ($language == "French")
-#macro (hello) bonjour #end
-#else
-#macro (hello) hello #end
-#end
-```
-
-There is no particular reason to define the same macro more than once, but if you do it is the
-first definition that is retained. In the `#if` example just above, the `bonjour` version will
-always be used.
-
-Macros can make templates hard to understand. You may prefer to put the logic in a Java method
-rather than a macro, and call the method from the template using `$methods.doSomething("foo")`
-or whatever.
-
-## Block quoting
-
-If you have text that should be treated verbatim, you can enclose it in `#[[...]]#`. The text
-represented by `...` will be copied into the output. `#` and `$` characters will have no
-effect in that text.
-
-```
-#[[ This is not a #directive, and this is not a $variable. ]]#
-```
-
-## Including other templates
-
-If you want to include a template from another file, you can use the `#parse` directive.
-This can be useful if you have macros that are shared between templates, for example.
-
-```
-#set ($foo = "bar")
-#parse("macros.vm")
-#mymacro($foo) ## #mymacro defined in macros.vm
-```
-
-For this to work, you will need to tell EscapeVelocity how to find "resources" such as
-`macro.vm` in the example. You might use something like this:
-
-```
-ResourceOpener resourceOpener = resourceName -> {
- InputStream inputStream = getClass().getResource(resourceName);
- if (inputStream == null) {
- throw new IOException("Unknown resource: " + resourceName);
- }
- return new BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8));
-};
-Template template = Template.parseFrom("foo.vm", resourceOpener);
-```
-
-In this case, the `resourceOpener` is used to find the main template `foo.vm`, as well as any
-templates it may reference in `#parse` directives.
-
-## <a name="spaces"></a> Spaces
-
-For the most part, spaces and newlines in the template are preserved exactly in the output.
-To avoid unwanted newlines, you may end up using `##` comments. In the `#foreach` example above
-we had this:
-
-```
-#foreach ($product in $allProducts)${product}#if ($foreach.hasNext), #end#end
-```
-
-That was to avoid introducing unwanted spaces and newlines. A more readable way to achieve the same
-result is this:
-
-```
-#foreach ($product in $allProducts)##
-${product}##
-#if ($foreach.hasNext), #end##
-#end
-```
-
-Spaces are ignored between the `#` of a directive and the `)` that closes it, so there is no trace
-in the output of the spaces in `#foreach ($product in $allProducts)` or `#if ($foreach.hasNext)`.
-Spaces are also ignored inside references, such as `$indexme[ $i ]` or `$callme( $i , $j )`.
-
-If you are concerned about the detailed formatting of the text from the template, you may want to
-post-process it. For example, if it is Java code, you could use a formatter such as
-[google-java-format](https://github.com/google/google-java-format). Then you shouldn't have to
-worry about extraneous spaces.
-
-[VelocityHacks]: https://github.com/google/auto/blob/ca2384d5ad15a0c761b940384083cf5c50c6e839/value/src/main/java/com/google/auto/value/processor/TemplateVars.java#L54
-[AutoValue]: https://github.com/google/auto/tree/master/value
diff --git a/src/main/java/com/google/escapevelocity/ReferenceNode.java b/src/main/java/com/google/escapevelocity/ReferenceNode.java
index 6302561..4b43f77 100644
--- a/src/main/java/com/google/escapevelocity/ReferenceNode.java
+++ b/src/main/java/com/google/escapevelocity/ReferenceNode.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/Reparser.java b/src/main/java/com/google/escapevelocity/Reparser.java
index 8e86180..7f87e89 100644
--- a/src/main/java/com/google/escapevelocity/Reparser.java
+++ b/src/main/java/com/google/escapevelocity/Reparser.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/Template.java b/src/main/java/com/google/escapevelocity/Template.java
index 3613dbe..1fd0273 100644
--- a/src/main/java/com/google/escapevelocity/Template.java
+++ b/src/main/java/com/google/escapevelocity/Template.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/main/java/com/google/escapevelocity/TokenNode.java b/src/main/java/com/google/escapevelocity/TokenNode.java
index a7226fc..971ad30 100644
--- a/src/main/java/com/google/escapevelocity/TokenNode.java
+++ b/src/main/java/com/google/escapevelocity/TokenNode.java
@@ -1,34 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/test/java/com/google/escapevelocity/ImmutableSetTest.java b/src/test/java/com/google/escapevelocity/ImmutableSetTest.java
deleted file mode 100644
index b0283dd..0000000
--- a/src/test/java/com/google/escapevelocity/ImmutableSetTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.google.escapevelocity;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/**
- * @author emcmanus@google.com (Éamonn McManus)
- */
-@RunWith(JUnit4.class)
-public class ImmutableSetTest {
- @Test
- public void empty() {
- ImmutableSet<String> empty = ImmutableSet.of();
- assertThat(empty).isEmpty();
- assertThat(empty).doesNotContain("");
- }
-
- @Test
- public void duplicates() {
- ImmutableSet<Integer> ints = ImmutableSet.of(1, 2, 3, 2, 1, 2, 3, 3);
- assertThat(ints).hasSize(3);
- assertThat(ints).containsExactly(1, 2, 3);
-
- ImmutableSet<Integer> ints2 = ImmutableSet.of(1, 2, 3, 4, 5, 3);
- assertThat(ints2).containsExactly(1, 2, 3, 4, 5);
- }
-}
diff --git a/src/test/java/com/google/escapevelocity/ReferenceNodeTest.java b/src/test/java/com/google/escapevelocity/ReferenceNodeTest.java
index c71eb1a..3e784f6 100644
--- a/src/test/java/com/google/escapevelocity/ReferenceNodeTest.java
+++ b/src/test/java/com/google/escapevelocity/ReferenceNodeTest.java
@@ -1,15 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
+ * 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 com.google.escapevelocity;
diff --git a/src/test/java/com/google/escapevelocity/TemplateTest.java b/src/test/java/com/google/escapevelocity/TemplateTest.java
index 0437734..04bad8e 100644
--- a/src/test/java/com/google/escapevelocity/TemplateTest.java
+++ b/src/test/java/com/google/escapevelocity/TemplateTest.java
@@ -1,15 +1,17 @@
/*
- * Copyright (C) 2015 Google, Inc.
+ * Copyright (C) 2018 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
+ * 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.
+ * 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 com.google.escapevelocity;