-
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.
Rename Any matcher, add lineText to each token, add start and end ind…
…ices for each token, add TerminalByContent to DSL
- Loading branch information
Showing
15 changed files
with
102 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
TODO should the parser and lexer provide their own Accept, Reject and Reason types? | ||
DONE Rename 'Any' to 'Anything' | ||
DONE update README.md | ||
DONE cleanup imports | ||
DONE cleanup repositories | ||
DONE matchers | ||
|
||
[ Matchers ] | ||
DONE implement a Rejection Reason | ||
DONE parser | ||
DONE proper error output | ||
DONE consider premature EOF | ||
DONE always consume all input | ||
DONE match terminal symbols | ||
DONE write a simple playbook | ||
TODO lexer | ||
|
||
[ Lexer ] | ||
TODO return a result accepting or rejecting the tokenized string, consider cases: | ||
Unexpected tokens | ||
No remaining tokens | ||
Trailing tokens | ||
TODO add a reference to the corresponding line in each token | ||
TODO test rule order | ||
DONE add a reference to the corresponding line text to each token | ||
DONE add start and end indices to Token | ||
DONE proper error output | ||
DONE implement line and column numbers | ||
DONE refactor ignore and produce rules in lexer | ||
DONE write a simple playbook | ||
|
||
[ Parser ] | ||
TODO bad parenthesis break everything on the parser | ||
DONE add TerminalByContent to dsl as terminal(Token("...")) | ||
DONE proper error output | ||
DONE consider premature EOF | ||
DONE always consume all input | ||
DONE match terminal symbols | ||
DONE write a simple playbook |
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
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package io.vexel.kobold.lexer.dsl | ||
|
||
import io.vexel.kobold.matchers.Any | ||
import io.vexel.kobold.matchers.Anything | ||
import io.vexel.kobold.matchers.Matcher | ||
|
||
interface AnyOperatorDSL { | ||
fun any(): Matcher | ||
} | ||
|
||
class AnyOperator : AnyOperatorDSL { | ||
override fun any() = Any() | ||
override fun any() = Anything() | ||
} |
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 was deleted.
Oops, something went wrong.
14 changes: 10 additions & 4 deletions
14
src/main/kotlin/io/vexel/kobold/parser/dsl/TerminalOperators.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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
package io.vexel.kobold.parser.dsl | ||
|
||
import io.vexel.kobold.Token | ||
import io.vexel.kobold.matchers.Matcher | ||
import io.vexel.kobold.matchers.TerminalByContent | ||
import io.vexel.kobold.matchers.TerminalByType | ||
|
||
interface TerminalOperatorDSL { | ||
fun<T> terminal(type: Class<T>): Matcher | ||
interface TerminalOperatorsDSL { | ||
fun<T: Token> terminal(type: Class<T>): Matcher | ||
fun terminal(token: Token): Matcher | ||
} | ||
|
||
class TerminalOperators : TerminalOperatorDSL { | ||
override fun<T> terminal(type: Class<T>) = | ||
class TerminalOperators : TerminalOperatorsDSL { | ||
override fun<T: Token> terminal(type: Class<T>) = | ||
TerminalByType(type) | ||
|
||
override fun terminal(token: Token) = | ||
TerminalByContent(token) | ||
} |
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
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