mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
parser: fix integer literals
This commit is contained in:
@ -46,4 +46,6 @@ object PorkElementTypes {
|
||||
|
||||
fun elementTypeFor(nodeType: NodeType): IElementType =
|
||||
nodeTypeToElementType[nodeType]!!
|
||||
|
||||
val FailedToParse: IElementType = IElementType("FailedToParse", PorkLanguage)
|
||||
}
|
||||
|
@ -17,5 +17,7 @@ class PorkParser : PsiParser {
|
||||
return builder.treeBuilt
|
||||
}
|
||||
|
||||
class ExitParser(val error: String) : RuntimeException("Exit Parser: $error")
|
||||
class ExitParser(val error: String? = null) : RuntimeException(
|
||||
if (error == null) "Fast Exit" else "Exit Parser: $error"
|
||||
)
|
||||
}
|
||||
|
@ -17,16 +17,20 @@ class PsiBuilderMarkAttribution(val builder: PsiBuilder) : ParserNodeAttribution
|
||||
while (!builder.eof()) {
|
||||
builder.advanceLexer()
|
||||
}
|
||||
throw PorkParser.ExitParser(e.error)
|
||||
throw PorkParser.ExitParser()
|
||||
} catch (e: ParseError) {
|
||||
marker.error(e.error)
|
||||
while (!builder.eof()) {
|
||||
builder.advanceLexer()
|
||||
}
|
||||
marker.error(e.error)
|
||||
throw PorkParser.ExitParser(e.error)
|
||||
throw PorkParser.ExitParser()
|
||||
} catch (e: PorkParser.ExitParser) {
|
||||
marker.error(e.error)
|
||||
throw e
|
||||
if (e.error != null) {
|
||||
marker.error(e.error)
|
||||
} else {
|
||||
marker.done(PorkElementTypes.FailedToParse)
|
||||
}
|
||||
throw PorkParser.ExitParser()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user