From d85e0f149dd6aef53b4acd4eefb0a70e27654cb1 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Wed, 18 Dec 2002 01:43:11 +0000 Subject: [PATCH] * lost patch from RH tree: 2001-09-17 graydon hoare * insn.scm (syntax-break-out): Correct logic in handling escaped syntax characters. --- ChangeLog | 5 +++++ insn.scm | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30f7ae7..ef07746 100644 --- a/ChangeLog +++ b/ChangeLog @@ -287,6 +287,11 @@ * cpu/m32r.opc: The same. * cpu/openrisc.opc: The same. +2001-09-17 graydon hoare + + * insn.scm (syntax-break-out): Correct logic in handling escaped + syntax characters. + 2001-07-12 Jeff Johnston * opc-itab.scm (@arch@_cgen_init_opcode_table): Unconditionally diff --git a/insn.scm b/insn.scm index 1806ea3..f438878 100644 --- a/insn.scm +++ b/insn.scm @@ -709,7 +709,7 @@ ; Filter out instructions whose ifield patterns are strict supersets of ; another, keeping the less general cousin. Used to resolve ambiguity -; when there are no more bits to consider while decoding. +; when there are no more bits to consider. (define (filter-non-specialized-ambiguous-insns insn-list) (logit 3 "Filtering " (length insn-list) " instructions for non specializations.\n") @@ -875,10 +875,12 @@ (cond ; Handle escaped syntax metacharacters ((char=? #\\ (string-ref syntax 0)) - (set! result (cons (substring syntax 0 1) result)) - (set! result (cons (substring syntax 1 1) result)) - (set! syntax (string-drop 2 syntax))) - ; Handle operand reference + (begin + (if (= (string-length syntax) 1) + (parse-error context "syntax-break-out: missing char after '\\' in " syntax)) + (set! result (cons (substring syntax 1 2) result)) + (set! syntax (string-drop 2 syntax)))) + ; Handle operand reference ((char=? #\$ (string-ref syntax 0)) ; Extract the symbol from the string, get the operand. (if (char=? #\{ (string-ref syntax 1)) -- 2.43.5