diff options
Diffstat (limited to 'src/LispParser.kt')
-rw-r--r-- | src/LispParser.kt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/LispParser.kt b/src/LispParser.kt index 3341779..48d0d45 100644 --- a/src/LispParser.kt +++ b/src/LispParser.kt @@ -10,10 +10,15 @@ class LispParser private constructor(filename: String, string: String) { fun parse(filename: String, string: String): LispAst.Program { return LispParser(filename, string).program } + fun parse(file: File): LispAst.Program { return parse(file.absolutePath, file.readText()) } + fun isValidIdentifier(name: String): Boolean { + return name.isNotEmpty() && name.first() in validStartingIdentifiers && name.all { it in validIdentifiers } + } + val digits = "1234567890" val hexDigits = digits + "abcdefABCDEF" val alphabet = "abcdefghijklmnopqrstuvwxyz" |