help-source-highlight
[Top][All Lists]
Advanced

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

Re: [Help-source-highlight] C-sharp; number of double type highlighting


From: Lorenzo Bettini
Subject: Re: [Help-source-highlight] C-sharp; number of double type highlighting
Date: Sun, 07 May 2006 12:06:25 +0200
User-agent: Thunderbird 1.5.0.2 (X11/20060501)

HEMMI, Shigeru wrote:
Dear Lorenzo Bettini,

2006/4/25, Lorenzo Bettini wote:
Hello,

I encounterd a small problem for a C-sharp source,
---------------------------------------------------------------------------=
-
namespace Foo
{
using System;
public class Foo
{
  public double one=1.0d;
  public double fr4=0.25d;
}
class testing
{
  public static void Main()
  {
    Foo x =3D new Foo();
      Console.WriteLine("one,fr4=3D"+x.one+", "+x.fr4);
  }
}
}
---------------------------------------------------------------------------=
-
Hilighting 1.0d and 0.25d seems a bit wrong.

mhhh... yes that should be a problem in the regular expressions for
numbers (I'll fix it); do you happen to know whether that's the same of
C/C++ numbers (I mean are 1.0d and 0.25d valid C/C++ literals)?

thanks
        Lorenzo

As you supposed, 1.0d and 0.25d are NOT valid C/C++ literals.
I checked it out in the following docs.

C# Real literals:
For definition, see "9.4.4.3 Real literals" of page 73.
For examples, see "8.2.1 Predefined types" of page 17.
in http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf


C++ Floating-Point Constants:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pluslang_c.2b2b_.floating.2d.point_constants.asp

Regards,

Hi

I attach the modified language definition file and a test

thanks again
        Lorenzo

--
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+
// classic HelloWorld in C#
using System;

/// <summary> 
/// classic HelloWorld in C#
/// </summary> 
class HelloWorld
{
	public double one=1.0d;
  	public double fr4=0.25d;
	public ulong val1 = 34Ul;

	/// <summary> The main method </summary> 
	static void Main() 
	{
		Console.WriteLine("Hello, World!");
	}
}
# definitions for C-sharp
# by S. HEMMI, updated by L. Bettini.
preproc = "using"

number = 
'\<[+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))([FfDdMmUulL]+)?\>'

include "cpp.lang"

subst keyword = "abstract|event|new|struct ",
 "as|explicit|null|switch",
 "base|extern|this",
 "false|operator|throw",
 "break|finally|out|true",
 "fixed|override|try",
 "case|params|typeof",
 "catch|for|private",
 "foreach|protected",
 "checked|goto|public|unchecked",
 "class|if|readonly|unsafe",
 "const|implicit|ref",
 "continue|in|return",
 "virtual",
 "default|interface|sealed|volatile",
 "delegate|internal",
 "do|is|sizeof|while",
 "lock|stackalloc",
 "else|static",
 "enum|namespace",
 "get|partial|set",
 "value|where|yield"

subst type = "bool|byte|sbyte|char|decimal|double",
 "float|int|uint|long|ulong|object",
 "short|ushort|string|void"

reply via email to

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