diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-02-26 20:59:37 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-02-26 21:13:54 -0800 |
commit | f95fdafa5b45d1dc72c2e85c04102238e584ea7c (patch) | |
tree | 26629fead664ffc8b223dbc9ec4ca12ea5da19cd /baremetal/shell | |
parent | 07eb5584c7c06cb0db967a7195ccdea6131da197 (diff) | |
download | mu-f95fdafa5b45d1dc72c2e85c04102238e584ea7c.tar.gz |
7806
Diffstat (limited to 'baremetal/shell')
-rw-r--r-- | baremetal/shell/read.mu | 121 |
1 files changed, 120 insertions, 1 deletions
diff --git a/baremetal/shell/read.mu b/baremetal/shell/read.mu index 6b1a0a82..19a38501 100644 --- a/baremetal/shell/read.mu +++ b/baremetal/shell/read.mu @@ -88,7 +88,8 @@ fn next-symbol-token in: (addr gap-buffer), out: (addr stream byte), trace: (add } fn is-symbol-grapheme? g: grapheme -> _/eax: boolean { - compare g, 0x20/space + ## whitespace + compare g, 9/tab { break-if-!= return 0/false @@ -98,11 +99,28 @@ fn is-symbol-grapheme? g: grapheme -> _/eax: boolean { break-if-!= return 0/false } + compare g, 0x20/space + { + break-if-!= + return 0/false + } + ## quotes compare g, 0x22/double-quote { break-if-!= return 0/false } + compare g, 0x27/single-quote + { + break-if-!= + return 0/false + } + compare g, 0x60/backquote + { + break-if-!= + return 0/false + } + ## brackets compare g, 0x28/open-paren { break-if-!= @@ -133,6 +151,107 @@ fn is-symbol-grapheme? g: grapheme -> _/eax: boolean { break-if-!= return 0/false } + # - other punctuation + # '!' is a symbol char + compare g, 0x23/hash + { + break-if-!= + return 0/false + } + # '$' is a symbol char + compare g, 0x25/percent + { + break-if-!= + return 0/false + } + compare g, 0x26/ampersand + { + break-if-!= + return 0/false + } + compare g, 0x2a/asterisk + { + break-if-!= + return 0/false + } + compare g, 0x2b/plus + { + break-if-!= + return 0/false + } + compare g, 0x2c/comma + { + break-if-!= + return 0/false + } + # '-' is a symbol char + compare g, 0x2e/period + { + break-if-!= + return 0/false + } + compare g, 0x2f/slash + { + break-if-!= + return 0/false + } + compare g, 0x2f/slash + { + break-if-!= + return 0/false + } + compare g, 0x3a/colon + { + break-if-!= + return 0/false + } + compare g, 0x3b/semi-colon + { + break-if-!= + return 0/false + } + compare g, 0x3c/less-than + { + break-if-!= + return 0/false + } + compare g, 0x3d/equal + { + break-if-!= + return 0/false + } + compare g, 0x3e/greater-than + { + break-if-!= + return 0/false + } + # '?' is a symbol char + compare g, 0x40/at-sign + { + break-if-!= + return 0/false + } + compare g, 0x5c/backslash + { + break-if-!= + return 0/false + } + compare g, 0x5e/caret + { + break-if-!= + return 0/false + } + # '_' is a symbol char + compare g, 0x7c/vertical-line + { + break-if-!= + return 0/false + } + compare g, 0x7e/tilde + { + break-if-!= + return 0/false + } return 1/true } |