We're checking types!!!!
This commit is contained in:
parent
f3c3a76671
commit
f272ffaca2
6 changed files with 304 additions and 24 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import type { Token } from './lexer'
|
||||
import type { AST, MatchCase, Pattern, Definition, TypeAST, TypeDefinition, TypeConstructor } from './ast'
|
||||
import type { AST, MatchCase, Pattern, Definition, TypeAST, TypeDefinition, TypeConstructor, Annotation } from './ast'
|
||||
import { ParseError } from './error'
|
||||
|
||||
export class Parser {
|
||||
|
|
@ -174,6 +174,12 @@ export class Parser {
|
|||
if (this.current().kind === 'colon') {
|
||||
this.advance();
|
||||
annotation = { constraints: [], type: this.parseType() };
|
||||
|
||||
// Declaration only
|
||||
if (this.current().kind === 'semicolon') {
|
||||
this.advance();
|
||||
return { kind: 'definition', name, annotation, ...this.getPos(nameToken) };
|
||||
}
|
||||
}
|
||||
|
||||
this.expect('equals');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue