[prev in list] [next in list] [prev in thread] [next in thread]
List: jedit-devel
Subject: Re: [ jEdit-devel ] Edit modes: DIGIT_RE problems
From: Slava Pestov <slava () jedit ! org>
Date: 2004-12-31 23:40:20
Message-ID: 41D5E364.8050607 () jedit ! org
[Download RAW message or body]
Hi,
Why constrain yourself to using DIGIT_RE? You can just define normal
syntax rules with a token type of DIGIT.
Gerd Knops wrote:
> Hi,
>
> I am trying to write an edit mode for an assembler. That assembler
> allows som number formats that I just can't seem to teach to jEdit:
>
> Hex: The assembler allows hex digits followed by a 'h', they do NOT have
> to start with a digit. Example is ffah. I tried [[:xdigit:]]+[Hh] with
> no luck. I even tried just ffah in the DIGIT_RE, even that doesn't work!
This is a limitation of the tokenizer. Only tokens containing at least
one digit are checked against DIGIT_RE. Instead, add a rule like so:
<MARK_PREVIOUS TYPE="DIGIT">h</MARK_PREVIOUS>
> Another problem: The assembler takes binary, octal, decimal and hex
> numbers in the form <R>'<digits>', where <R> identifies the radix and
> <digits> are valid digits in that radix. Examples:
>
> B'010101'
> O'01234'
> D'01234'
> H'123abAB'
>
> I tried
>
> [Bb]'[01]+'|[OoQq]'[0-7]+'|[Dd]'[[:digit:]]+'|[Hh]'[[:xdigit:]]+'
Add SPAN rules:
<SPAN TYPE="DIGIT">
<BEGIN>B'</BEGIN>
<END>'</END>
</SPAN>
and so on.
>
> but no dice. I even added
>
> <PROPERTY NAME="noWordSep" VALUE="._'" />
This property is not used for syntax highlighting. Add a NO_WORD_SEP
attribute to the RULES tag.
> Last problem: Any character in single quotes is replaced by an unsigned
> char value, example 'a'. I tried '.' and you guessed it, no such luck.
Again, just use a SPAN.
Slava
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
--
-----------------------------------------------
jEdit Developers' List
jEdit-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic