[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: forward-sexp when on a floating point number

From: Herring, Davis
Subject: RE: forward-sexp when on a floating point number
Date: Tue, 12 Jan 2016 13:58:38 +0000

>     (modify-syntax-entry ?\. "w" c++-mode-syntax-table)

This could be done for only those periods following numbers with a font-lock 
syntactic highlight:

("[0-9]\\(\\.\\)" 1 "_")    ; you want "symbol", not "word" anyway

Better would be to check for numbers after it too, to catch numbers less than 1 
with no leading zero.

>                  (looking-back "[0-9]+" (line-beginning-position)))

Just use "[0-9]"; how many doesn't matter.

>         (skip-chars-forward "[0-9]")))

You want [-+0-9e] to handle scientific notation too.  In C you also need to 
tolerate a trailing "d" or "f" for full generality.  Of course, from after the 
decimal your command won't skip + or -, because you can't tell (looking only 
forward) that "1e+2" isn't part of "0x1e+2".  So more font-lock trickery would 
be better (other than in requiring font-lock!), since it could mark the "-/+" 
ahead of time.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]