Skip to content

Commit

Permalink
add String.toDataType convenient extension function
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-chung committed Apr 13, 2024
1 parent d4d5b39 commit 7073ac3
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.sunnychung.lib.multiplatform.kotlite.extension

import com.sunnychung.lib.multiplatform.kotlite.Parser
import com.sunnychung.lib.multiplatform.kotlite.lexer.Lexer
import com.sunnychung.lib.multiplatform.kotlite.model.SymbolTable

fun String.toDataType(symbolTable: SymbolTable) =
Parser(Lexer("-", this)).type(isParseDottedIdentifiers = true, isIncludeLastIdentifierAsTypeName = true)
.let { symbolTable.assertToDataType(it) }

0 comments on commit 7073ac3

Please sign in to comment.