X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Ftests%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Ftests%2FRangeParsingTest.java;fp=bundles%2Forg.simantics.graph.compiler%2Ftests%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Ftests%2FRangeParsingTest.java;h=05f073e52a2b9401e4bd63876cf1deb81b1f2605;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=4d2e2f201ffb42294f113b45193038f41375fb33;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/RangeParsingTest.java b/bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/RangeParsingTest.java index 4d2e2f201..05f073e52 100644 --- a/bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/RangeParsingTest.java +++ b/bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/RangeParsingTest.java @@ -1,41 +1,41 @@ -package org.simantics.graph.compiler.tests; - -import org.antlr.runtime.ANTLRStringStream; -import org.antlr.runtime.CharStream; -import org.antlr.runtime.CommonTokenStream; -import org.antlr.runtime.Token; -import org.antlr.runtime.TokenStream; -import org.antlr.runtime.tree.Tree; -import org.junit.Test; -import org.simantics.databoard.util.Range; -import org.simantics.graph.compiler.internal.parsing.GraphLexer; -import org.simantics.graph.compiler.internal.parsing.GraphParser; - -public class RangeParsingTest { - - public static GraphParser parse(String text) { - CharStream stream = new ANTLRStringStream(text); - GraphLexer lexer = new GraphLexer(stream); - TokenStream tokenStream = new CommonTokenStream(lexer); - for(int i=1;;++i) { - Token token = tokenStream.LT(i); - if(token.getType() == GraphParser.EOF) - break; - System.out.println( - GraphParser.tokenNames[token.getType()] + " " + token.getText()); - } - return new GraphParser(tokenStream); - } - - @Test - public void testRangeParsing() throws Exception { - Tree tree = (Tree)parse("[1..2.3]").parameterValue().getTree(); - System.out.println(tree.toStringTree()); - } - - @Test - public void testRangeInDataboard() throws Exception { - Range.valueOfUnchecked("[0..1]"); - } - -} +package org.simantics.graph.compiler.tests; + +import org.antlr.runtime.ANTLRStringStream; +import org.antlr.runtime.CharStream; +import org.antlr.runtime.CommonTokenStream; +import org.antlr.runtime.Token; +import org.antlr.runtime.TokenStream; +import org.antlr.runtime.tree.Tree; +import org.junit.Test; +import org.simantics.databoard.util.Range; +import org.simantics.graph.compiler.internal.parsing.GraphLexer; +import org.simantics.graph.compiler.internal.parsing.GraphParser; + +public class RangeParsingTest { + + public static GraphParser parse(String text) { + CharStream stream = new ANTLRStringStream(text); + GraphLexer lexer = new GraphLexer(stream); + TokenStream tokenStream = new CommonTokenStream(lexer); + for(int i=1;;++i) { + Token token = tokenStream.LT(i); + if(token.getType() == GraphParser.EOF) + break; + System.out.println( + GraphParser.tokenNames[token.getType()] + " " + token.getText()); + } + return new GraphParser(tokenStream); + } + + @Test + public void testRangeParsing() throws Exception { + Tree tree = (Tree)parse("[1..2.3]").parameterValue().getTree(); + System.out.println(tree.toStringTree()); + } + + @Test + public void testRangeInDataboard() throws Exception { + Range.valueOfUnchecked("[0..1]"); + } + +}