Created
November 2, 2019 13:38
-
-
Save jnorthrup/6e4de50bf01aa221340f89307b4bcd2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.IllegalArgumentException: The tokens list should not be empty | |
at com.github.h0tk3y.betterParse.lexer.DefaultTokenizer.<init>(DefaultTokenizer.kt:9) | |
at com.github.h0tk3y.betterParse.grammar.Grammar$tokenizer$2.invoke(Grammar.kt:31) | |
at com.github.h0tk3y.betterParse.grammar.Grammar$tokenizer$2.invoke(Grammar.kt:17) | |
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) | |
at com.github.h0tk3y.betterParse.grammar.Grammar.getTokenizer(Grammar.kt) | |
at com.github.h0tk3y.betterParse.grammar.GrammarKt.tryParseToEnd(Grammar.kt:63) | |
at com.fnreport.sentenceTest$1.invoke(sentenceTest.kt:28) | |
at com.fnreport.sentenceTest$1.invoke(sentenceTest.kt:21) | |
at io.kotlintest.Spec$runTest$callable$1$1.invoke(Spec.kt:124) | |
at io.kotlintest.Spec$runTest$callable$1$1.invoke(Spec.kt:15) | |
at io.kotlintest.Spec$runTest$initialInterceptor$1$1.invoke(Spec.kt:116) | |
at io.kotlintest.Spec$runTest$initialInterceptor$1$1.invoke(Spec.kt:15) | |
at io.kotlintest.Spec.interceptTestCase(Spec.kt:78) | |
at io.kotlintest.Spec$runTest$initialInterceptor$1.invoke(Spec.kt:116) | |
at io.kotlintest.Spec$runTest$initialInterceptor$1.invoke(Spec.kt:15) | |
at io.kotlintest.Spec$runTest$callable$1.call(Spec.kt:124) | |
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) | |
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) | |
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) | |
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) | |
at java.base/java.lang.Thread.run(Thread.java:835) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.fnreport</groupId> | |
<artifactId>lownal</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<repositories> | |
<repository> | |
<id>bintray-kotlin-kotlinx</id> | |
<name>bintray</name> | |
<url>https://kotlin.bintray.com/kotlinx</url> | |
</repository> | |
</repositories> | |
<properties> | |
<kotlin.version>1.3.50</kotlin.version> | |
<serialization.version>0.13.0</serialization.version> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<maven.compiler.source>11</maven.compiler.source> | |
<maven.compiler.target>11</maven.compiler.target> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-core</artifactId> | |
<version>1.3.2</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-core-common</artifactId> | |
<version>1.3.2</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-jdk8</artifactId> | |
<version>1.3.2</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib</artifactId> | |
<version>${kotlin.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib-common</artifactId> | |
<version>${kotlin.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib-jdk8</artifactId> | |
<version>${kotlin.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-test</artifactId> | |
<version>${kotlin.version}</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>io.kotlintest</groupId> | |
<artifactId>kotlintest</artifactId> | |
<version>2.0.7</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>io.kotlintest</groupId> | |
<artifactId>kotlintest-core</artifactId> | |
<version>3.4.1</version> | |
<scope>test</scope> | |
</dependency> | |
<!-- com/github/h0tk3y/betterParse/better-parse-multiplatform-jvm/0.4.2/better-parse-multiplatform-jvm-0.4.2--> | |
<dependency> | |
<groupId>com.github.h0tk3y.betterParse</groupId> | |
<artifactId>better-parse-multiplatform</artifactId> | |
<version>0.4.2</version> <exclusions> | |
<exclusion> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib-commmon</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>com.github.h0tk3y.betterParse</groupId> | |
<artifactId>better-parse-multiplatform-jvm</artifactId> | |
<version>0.4.2</version> | |
<exclusions> | |
<exclusion> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib-commmon</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-maven-plugin</artifactId> | |
<version>${kotlin.version}</version> | |
<executions> | |
<execution> | |
<id>compile</id> | |
<phase>compile</phase> | |
<goals> | |
<goal>compile</goal> | |
</goals> | |
</execution> | |
<execution> | |
<id>test-compile</id> | |
<phase>test-compile</phase> | |
<goals> | |
<goal>test-compile</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<compilerPlugins> | |
<plugin>kotlinx-serialization</plugin> | |
</compilerPlugins> | |
<jvmTarget>11</jvmTarget> | |
</configuration> | |
<dependencies> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-maven-serialization</artifactId> | |
<version>${kotlin.version}</version> | |
</dependency> | |
</dependencies> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fnreport | |
import com.github.h0tk3y.betterParse.combinators.use | |
import com.github.h0tk3y.betterParse.grammar.Grammar | |
import com.github.h0tk3y.betterParse.grammar.tryParseToEnd | |
import com.github.h0tk3y.betterParse.lexer.LiteralToken | |
import com.github.h0tk3y.betterParse.parser.Parser | |
import io.kotlintest.specs.StringSpec | |
object grammar: Grammar<String?>() { | |
val lit = LiteralToken("word","[^\\s+]") | |
val word2 = lit use { text} | |
override val rootParser: Parser<String?> by word2 | |
} | |
class sentenceTest : StringSpec() { | |
val in1: String = "<(&&,<$1-->(/,REPRESENT,_,$2)>,<(*,$3,$4)-->REPRESENT>)==><$1-->(/,(/,REPRESENT,_,<(*,$4,$2)-->FOOD>),$3,eat,_)>>.%1.00;0.45%" | |
init { | |
"capture"{ | |
val tryParseToEnd = grammar.tryParseToEnd("word") | |
System.err.println(tryParseToEnd) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment