-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from adriantodt/feature/v3
Major version v3.0
- Loading branch information
Showing
47 changed files
with
543 additions
and
373 deletions.
There are no files selected for viewing
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
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
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
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
53 changes: 0 additions & 53 deletions
53
src/commonMain/kotlin/com/github/adriantodt/tartar/Tartar.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/commonMain/kotlin/com/github/adriantodt/tartar/api/FunctionTypes.kt
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
src/commonMain/kotlin/com/github/adriantodt/tartar/api/dsl/CharPredicate.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.github.adriantodt.tartar.api.dsl | ||
|
||
/** | ||
* Represents a predicate (boolean-valued function) of one [Char]-valued argument. | ||
* | ||
* @since 3.0 | ||
*/ | ||
public fun interface CharPredicate { | ||
/** | ||
* Evaluates this predicate on the given argument. | ||
* | ||
* @param value the input argument | ||
* @return true if the input argument matches the predicate, otherwise false. | ||
*/ | ||
public fun test(value: Char): Boolean | ||
|
||
public companion object { | ||
/** | ||
* [CharPredicate] which predicate is the function [Char.isLetter]. | ||
*/ | ||
public val isLetter: CharPredicate = CharPredicate(Char::isLetter) | ||
|
||
/** | ||
* [CharPredicate] which predicate is the function [Char.isDigit]. | ||
*/ | ||
public val isDigit: CharPredicate = CharPredicate(Char::isDigit) | ||
|
||
/** | ||
* [CharPredicate] which predicate is the function [Char.isLetterOrDigit]. | ||
*/ | ||
public val isLetterOrDigit: CharPredicate = CharPredicate(Char::isLetterOrDigit) | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
src/commonMain/kotlin/com/github/adriantodt/tartar/api/dsl/GrammarFunctionTypes.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.github.adriantodt.tartar.api.dsl | ||
|
||
import com.github.adriantodt.tartar.api.parser.ParserContext | ||
import com.github.adriantodt.tartar.api.parser.Token | ||
|
||
/** | ||
* Function used by [GrammarDSL] to configure a | ||
* [Prefix Parselet][com.github.adriantodt.tartar.api.parser.PrefixParselet] | ||
* in a functional way. | ||
*/ | ||
public typealias PrefixFunction<T, E> = ParserContext<T, E>.(token: Token<T>) -> E | ||
|
||
/** | ||
* Function used by [GrammarDSL] to configure a | ||
* [Infix Parselet][com.github.adriantodt.tartar.api.parser.InfixParselet] | ||
* in a functional way. | ||
*/ | ||
public typealias InfixFunction<T, E> = ParserContext<T, E>.(left: E, token: Token<T>) -> E | ||
|
||
/** | ||
* Function which receives a [LexerDSL] as its receiver. | ||
*/ | ||
public typealias GrammarConfig<T, E> = GrammarDSL<T, E>.() -> Unit |
Oops, something went wrong.