#144 \n and \r doesn't works

colorer-take5
closed-invalid
nobody
5
2009-05-18
2009-05-15
Alexander Krisak
No

In lua.hrc "if" expression defined as

;-----------------X8
<scheme name="OutlinedStructures">
<block start="/(?{Outline}(?{PairStart}(?{Keyword}if))\s+\M.*)\s+then/"
end="/\b(?{PairEnd}(?{Keyword}end))\b/" scheme="lua"/>
</scheme>
;-----------------X8

if i use following code, colorer works fine:

;-----------------X8
l=nil
if l == nil then
print("n is nil")
end
;-----------------X8

but if i use "\n" i.e.:

;-----------------X8
l=nil
if l == nil
then
print("n is nil")
end
;-----------------X8

if and end not colorized. i'm tried to use "[\n\r\t ]" instead of "\s" and it's doesn't helps. i'm tried to use [\x10\x13\t ] with same result. I changed rule for "if" to:

;-----------------X8
<scheme name="OutlinedStructures">
<block start="/(?{Outline}(?{PairStart}(?{Keyword}if))\s+\M.*)\s+then[\n\r\t ]/"
end="/\b(?{PairEnd}(?{Keyword}end))\b/" scheme="lua"/>
</scheme>
;-----------------X8

Colorization didn't recognized first script as well as second.

Sorry for my bad english.

Discussion

  • lua.hcr and test sample

     
    Attachments
  • Igor Russkih
    Igor Russkih
    2009-05-18

    Sorry, but this is one of colorer's functional limitations. It can't spread over a few lines in a single RE.

    You only have to reformulate the HRC rule in some other way as a workaround. (f.e. removing "then" searching in this construct).

     
  • Igor Russkih
    Igor Russkih
    2009-05-18

    • status: open --> closed-invalid