type-section-rework #6

Merged
sashakoshka merged 46 commits from type-section-rework into main 2022-09-17 10:36:27 -06:00
2 changed files with 11 additions and 18 deletions
Showing only changes of commit 85f97189ac - Show all commits

View File

@ -139,25 +139,16 @@ func (parser *ParsingOperation) parseBlockLevelPhrase (
err = parser.expect(validDelimitedPhraseTokens...)
if err != nil { return }
// we are delimited so we can safely skip whitespace
err = parser.skipWhitespace()
if err != nil { return }
if parser.token.Is(lexer.TokenKindRBracket) {
// this is an ending delimiter
err = parser.nextToken()
if err != nil { return }
break
} else if parser.token.Is(lexer.TokenKindNewline) {
// we are delimited, so we can safely skip
// newlines
err = parser.nextToken()
if err != nil { return }
continue
} else if parser.token.Is(lexer.TokenKindIndent) {
// we are delimited, so we can safely skip
// indents
err = parser.nextToken()
if err != nil { return }
continue
}
} else {
// not delimited
@ -176,7 +167,7 @@ func (parser *ParsingOperation) parseBlockLevelPhrase (
}
}
// this is an argument
// if we've got this far, we are parsing an argument
var argument Argument
argument, err = parser.parseArgument()
phrase.arguments = append(phrase.arguments, argument)
@ -222,10 +213,9 @@ func (parser *ParsingOperation) parseBlockLevelPhrase (
}
}
if !isControlFlow { return }
// if it is any of those, parse the block under it
phrase.block, err = parser.parseBlock(indent + 1)
if isControlFlow {
phrase.block, err = parser.parseBlock(indent + 1)
}
return
}
@ -318,6 +308,8 @@ func (parser *ParsingOperation) parsePhraseCommand () (
identifier := command.value.(Identifier)
if len(identifier.trail) == 1 {
switch identifier.trail[0] {
case "let":
kind = PhraseKindLet
case "loc":
kind = PhraseKindReference
case "defer":

View File

@ -231,6 +231,7 @@ const (
PhraseKindCall = iota
PhraseKindCallExternal
PhraseKindOperator
PhraseKindLet
PhraseKindAssign
PhraseKindReference
PhraseKindDefer