Page 1 of 1

char "{" could not write in char class with {..}

Posted: Tue Aug 02, 2016 2:45 pm
by ssqq

Code: Select all

> {[{]}

ERR: string token too long : "[{]}"
> {[\{]}

ERR: string token too long : "[\\{]}"
;; \nnn also could not recognize in {..}
> {\123}
"\\123"


Re: char "{" could not write in char class with {..}

Posted: Tue Aug 02, 2016 5:10 pm
by ssqq

Code: Select all

> {[\Q{\E]}
ERR: string token too long : "[\\Q{\\E]}"
> {[\Q\{\E]}
ERR: string token too long : "[\\Q\\{\\E]}"

Re: char "{" could not write in char class with {..}

Posted: Tue Aug 02, 2016 5:15 pm
by ssqq
But if code is in file, it is OK.

Code: Select all

ssqq@X61:~/spp-newlisp$ cat debug.lsp 
(constant 'say println)

(define (regex-str-char @str)
  (replace {([\Q()[]{}|\.+*?^$\E])} @str (string {\} $1) 0))

(say (regex-str-char "{}()"))

(exit)
ssqq@X61:~/spp-newlisp$ newlisp debug.lsp 
\{\}\(\)