hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit e4f4d13b0a2683287eb14e9e65e44bdc6a9ad18d
parent 635512e580e9f523ec73ffb6c1198b64dd92d2a9
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Mon,  3 May 2021 02:48:43 -0400

hare::parse: make error types a prefix

Diffstat:
Mhare/parse/type.ha | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hare/parse/type.ha b/hare/parse/type.ha @@ -375,9 +375,14 @@ fn enum_type(lexer: *lex::lexer) (ast::_type | error) = { // Parses a type, e.g. '[]int'. export fn _type(lexer: *lex::lexer) (ast::_type | error) = { - let flags: ast::type_flags = match (try(lexer, ltok::CONST)?) { - void => 0, - * => ast::type_flags::CONST, + let flags: ast::type_flags = 0; + match (try(lexer, ltok::CONST)?) { + void => void, + * => flags |= ast::type_flags::CONST, + }; + match (try(lexer, ltok::LNOT)?) { + void => void, + * => flags |= ast::type_flags::ERROR, }; let tok = peek(lexer)? as lex::token; let typ: ast::_type = switch (tok.0) { @@ -408,11 +413,6 @@ export fn _type(lexer: *lex::lexer) (ast::_type | error) = { lex::tokstr(tok)), }; - match (try(lexer, ltok::LNOT)?) { - void => void, - * => flags |= ast::type_flags::ERROR, - }; - typ.flags |= flags; return typ; };