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

For the Compleat Fan
Locked
ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

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

Post by ssqq »

Code: Select all

> {[{]}

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

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


ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

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

Post by ssqq »

Code: Select all

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

ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

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

Post 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 
\{\}\(\)


Locked