[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.
Davis
- forward-sexp when on a floating point number, Oleh Krehel, 2016/01/12
- RE: forward-sexp when on a floating point number,
Herring, Davis <=
- Re: forward-sexp when on a floating point number, Andreas Schwab, 2016/01/12
- Re: forward-sexp when on a floating point number, John Wiegley, 2016/01/12
- Re: forward-sexp when on a floating point number, Dmitry Gutov, 2016/01/12
- Re: forward-sexp when on a floating point number, Stefan Monnier, 2016/01/17