From f95fdafa5b45d1dc72c2e85c04102238e584ea7c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 Feb 2021 20:59:37 -0800 Subject: 7806 --- baremetal/shell/read.mu | 121 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) (limited to 'baremetal/shell') 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 } -- cgit 1.4.1-2-gfad0