hare

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

commit 6f36c0c29bcc50d1c7d8406430da809d956f52f6
parent 028e1619fa69ef69509622d24bac5231521b393c
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu, 22 Apr 2021 13:39:41 -0400

hare::lex: improve docs

Diffstat:
Mhare/lex/lex.ha | 1-
Mhare/lex/token.ha | 6+++---
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha @@ -9,7 +9,6 @@ use strings; use strio; use types; -// State associated with a lexer. export type lexer = struct { in: *io::stream, path: str, diff --git a/hare/lex/token.ha b/hare/lex/token.ha @@ -1,7 +1,7 @@ use encoding::utf8; use strings; -// A token with no additional context, such as '+' +// A lexical token class. export type ltok = enum uint { // Keep ordered with bmap // Alpha sorted @@ -256,7 +256,7 @@ const bmap: [_]str = [ "*=", ]; -// A token value, used for tokens such as '1337u32' +// A token value, used for tokens such as '1337' (an integer). export type value = (str | rune | i64 | u64 | f64 | void); // A location within a source file. @@ -270,7 +270,7 @@ export type location = struct { // A single lexical token. export type token = (ltok, value, location); -// Converts a token to its string representation +// Converts a token to its string representation. export fn tokstr(tok: token) const str = { if (tok.0 <= ltok::LAST_BTOK) { return bmap[tok.0: int];