Skip to content

Commit

Permalink
Advance version to 0.3.1, fix non-nullable structureParsers and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tk3y committed Oct 29, 2017
1 parent 813d1cb commit 48c2edb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repositories {
}

dependencies {
compile 'com.github.h0tk3y.betterParse:better-parse:0.3.0'
compile 'com.github.h0tk3y.betterParse:better-parse:0.3.1'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.github.h0tk3y.betterParse'
version '0.3.0'
version '0.3.1'

buildscript {
ext.kotlin_version = '1.1.51'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fun <T> Parser<T>.liftToSyntaxTreeParser(
/** Converts a [Grammar] so that its [Grammar.rootParser] parses a [SyntaxTree]. See: [liftToSyntaxTreeParser]. */
fun <T> Grammar<T>.liftToSyntaxTreeGrammar(
liftOptions: LiftToSyntaxTreeOptions = LiftToSyntaxTreeOptions(),
structureParsers: Set<Parser<*>> = declaredParsers,
structureParsers: Set<Parser<*>>? = declaredParsers,
transformer: LiftToSyntaxTreeTransformer? = null
) = object : Grammar<SyntaxTree<T>>() {
override val rootParser: Parser<SyntaxTree<T>> = this@liftToSyntaxTreeGrammar.rootParser
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/generated/andFunctions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.h0tk3y.betterParse.combinators
import com.github.h0tk3y.betterParse.parser.Parser
import com.github.h0tk3y.betterParse.utils.*
import com.github.h0tk3y.betterParse.parser.*

@JvmName("and2") inline infix fun <reified T1, reified T2, reified T3>
AndCombinator<Tuple2<T1, T2>>.and(p3: Parser<T3>) =
Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/TestLiftToAst.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ private fun SyntaxTree<*>.toTopDownStrings() = topDownNodesSequence()
class TestLiftToAst {
@Test
fun continuousRange() {
val astParser = booleanGrammar.liftToSyntaxTreeGrammar(LiftToSyntaxTreeOptions(retainSkipped = true), structureParsers = emptySet())
val astParser = booleanGrammar.liftToSyntaxTreeGrammar(LiftToSyntaxTreeOptions(retainSkipped = true), structureParsers = null)
val ast = astParser.parseToEnd("a&(b1->c1)|a1&!b|!(a1->a2)->a")
checkAstContinuousRange(ast)
}

@Test
fun astStructure() {
val astParser = booleanGrammar.liftToSyntaxTreeGrammar(LiftToSyntaxTreeOptions(retainSkipped = true), structureParsers = emptySet())
val astParser = booleanGrammar.liftToSyntaxTreeGrammar(LiftToSyntaxTreeOptions(retainSkipped = true), structureParsers = null)
val ast = astParser.parseToEnd("(!(a)->((b)|(!c))->!(!a)&!(d))")
val types = ast.toTopDownStrings()

Expand All @@ -86,7 +86,7 @@ class TestLiftToAst {

@Test
fun testDropSkipped() {
val astParser = booleanGrammar.liftToSyntaxTreeGrammar(LiftToSyntaxTreeOptions(retainSkipped = false), structureParsers = emptySet())
val astParser = booleanGrammar.liftToSyntaxTreeGrammar(LiftToSyntaxTreeOptions(retainSkipped = false), structureParsers = null)
val ast = astParser.parseToEnd("(!(a)->((b)|(!c))->!(!a)&!(d))")
val types = ast.toTopDownStrings()

Expand Down

0 comments on commit 48c2edb

Please sign in to comment.