[code] [textadept] Parsing character literal with LPeg lexer

From: suharik <suharik.att.anche.no>
Date: Tue, 18 Feb 2014 14:28:49 +0400

I'm trying to implement a rust lexer.

Character literal are described here: http://static.rust-lang.org/doc/master/rust.html#character-and-string-literals
So I wrote this:

    local char_body = -P("'") + P("\\") * P("'") + P("\\") * ("\\" + S("nrt0") + "x"*l.xdigit^2 + "u"*l.xdigit^4 + "U"*l.xdigit^8)
    local char_lit = "'" + char_body + "'"

But there is a problem:

    Lua Error: /usr/share/textadept/lexers/lexer.lua:933: loop body may accept empty string.

So, what's gone wrong and what “loop body may accept empty string” means? Textadept version: 7.1.

PS: no, l.delimited_range doesn't cut it: language have things like “BitsNStrings<'a>”.

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 18 Feb 2014 - 05:28:49 EST

This archive was generated by hypermail 2.2.0 : Tue 18 Feb 2014 - 06:40:58 EST