char

fun char(b: CharacterBuilderBlock): EvalPE<Char>

Parsing expression that represents any character that satisfies the b lambda.

Samples

import io.kpeg.pe.Symbol.Rule
fun main() { 
   //sampleStart 
   // 'a' - OK
// 'F' - OK
// 'ы' - OK
// 'ñ' - OK
// '2' - FAIL

char { it.isLetter() } // EvalPE<Char> 
   //sampleEnd
}
fun char(c: Char): EvalPE<Char>

Parsing expression that represents the character c.

Samples

import io.kpeg.pe.Symbol.Rule
fun main() { 
   //sampleStart 
   // 'a' - OK
// 'A' - FAIL
// 'f' - FAIL

char('a') // EvalPE<Char> 
   //sampleEnd
}
fun char(r: CharRange): EvalPE<Char>

Parsing expression that represents any character in the char range r.

Samples

import io.kpeg.pe.Symbol.Rule
fun main() { 
   //sampleStart 
   // 'a' - OK
// 'A' - FAIL
// 'f' - OK

char('a'..'f') // EvalPE<Char> 
   //sampleEnd
}
fun char(firstC: Char, secondC: Char, vararg otherCs: Char): EvalPE<Char>

Parsing expression that represents any character from the firstC, secondC, or otherCs characters.

Samples

import io.kpeg.pe.Symbol.Rule
fun main() { 
   //sampleStart 
   // 'a' - OK
// 'A' - FAIL
// 'f' - OK
// 'e' - FAIL

char('a', 'b', 'f') // EvalPE<Char> 
   //sampleEnd
}