[svn] r6769: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
Nemerle.Com...
IT
svnadmin at nemerle.org
Thu Oct 19 06:04:31 CEST 2006
Log:
1. Added background for verbatim strings.
2. Added colors for standard string formatting.
Author: IT
Date: Thu Oct 19 06:04:28 2006
New Revision: 6769
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanTokenColor.n
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n Thu Oct 19 06:04:28 2006
@@ -156,6 +156,14 @@
}
}
+ private SColor(isEx : bool) : C
+ {
+ if (isEx)
+ if (_tokenInfo.IsMultiLineString) C.VerbatimStringEx else C.StringEx
+ else
+ if (_tokenInfo.IsMultiLineString) C.VerbatimString else C.String
+ }
+
private GetStringToken() : Token * ScanTokenType * ScanTokenColor * ScanTokenTriggers
{
when (_tokenInfo.IsDollar && _bracketCount < 0)
@@ -199,8 +207,10 @@
}
}
+ def c = SColor(true);
+
loop();
- (Token.StringLiteral(CurrentValue), TP.String, C.StringEx, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, c, TR.None)
}
if (_bracketCount > 0)
@@ -212,14 +222,16 @@
| '"' when _tokenInfo.IsMultiLineString && peek_next() == '"' =>
repeat (2) skip();
- (Token.StringLiteral(CurrentValue), TP.String, C.StringEx, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(true), TR.None)
| '"' =>
- _Debug('"');
skip();
+
+ def c = SColor(false);
+
_tokenInfo.State &= ~(ScanState.String | ScanState.MultiLineString);
- (Token.StringLiteral(CurrentValue), TP.String, C.String, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, c, TR.None)
| '\\' when !_tokenInfo.IsMultiLineString =>
@@ -232,17 +244,38 @@
def tok = try
{
_ = escape_value(read());
- (Token.StringLiteral(CurrentValue), TP.String, C.StringEx, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(true), TR.None)
}
catch
{
- _ => (Token.StringLiteral(CurrentValue), TP.String, C.String, TR.None)
+ _ => (Token.StringLiteral(CurrentValue), TP.String, SColor(false), TR.None)
}
Manager.Options.ThrowOnError = opt;
tok;
+ | '{' when peek_next() == '{' =>
+
+ repeat (2) skip();
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(false), TR.None)
+
+ | '{' =>
+
+ def loop()
+ {
+ match (peek())
+ {
+ | '\0' | '"' => (); false;
+ | '}' => skip(); true;
+ | _ => skip(); loop();
+ }
+ }
+
+ skip();
+ def ex = loop();
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(ex), TR.None)
+
| '$' when _tokenInfo.IsDollar && peek_next() == '(' =>
skip();
@@ -250,8 +283,6 @@
| '$' when _tokenInfo.IsDollar && IsIdBeginning(peek_next()) =>
- repeat (2) skip();
-
def loop()
{
def ch = peek();
@@ -263,8 +294,9 @@
}
}
+ repeat (2) skip();
loop();
- (Token.StringLiteral(CurrentValue), TP.String, C.StringEx, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(true), TR.None)
| _ =>
@@ -273,13 +305,13 @@
skip();
match (peek())
{
- | '"' | '\\' | '$' when _tokenInfo.IsDollar | '\0' => ()
+ | '"' | '\\' | '{' | '$' when _tokenInfo.IsDollar | '\0' => ()
| _ => loop()
}
}
loop();
- (Token.StringLiteral(CurrentValue), TP.String, C.String, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(false), TR.None)
}
}
@@ -478,7 +510,7 @@
| _ => throw InvalidOperationException()
}
- (Token.StringLiteral(CurrentValue), TP.String, C.String, TR.None)
+ (Token.StringLiteral(CurrentValue), TP.String, SColor(false), TR.None)
}
match (peek())
@@ -571,6 +603,8 @@
| Number => ScanTokenColor.QuotationNumber
| Operator => ScanTokenColor.QuotationOperator
| StringEx => ScanTokenColor.QuotationStringEx
+ | VerbatimString => ScanTokenColor.QuotationVerbatimString
+ | VerbatimStringEx => ScanTokenColor.QuotationVerbatimStringEx
| _ => _tokenInfo.Color
}
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanTokenColor.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanTokenColor.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanTokenColor.n Thu Oct 19 06:04:28 2006
@@ -5,27 +5,30 @@
public enum ScanTokenColor
{
// The first 6 items in this list MUST be these default items.
- | Text = 0
| Keyword = 1
| Comment = 2
| Identifier = 3
| String = 4
| Number = 5
+ | Text = 6
| Operator = 7
- | StringEx = 8
+ | Preprocessor
+ | StringEx
+ | VerbatimString
+ | VerbatimStringEx
- | Quotation = 9
+ | Quotation
+ | QuotationText
+ | QuotationKeyword
+ | QuotationComment
+ | QuotationIdentifier
+ | QuotationString
+ | QuotationNumber
+ | QuotationOperator
+ | QuotationStringEx
+ | QuotationVerbatimString
+ | QuotationVerbatimStringEx
- | QuotationText = 10
- | QuotationKeyword = 11
- | QuotationComment = 12
- | QuotationIdentifier = 13
- | QuotationString = 14
- | QuotationNumber = 15
- | QuotationOperator = 16
- | QuotationStringEx = 17
-
- | Preprocessor = 18
}
}
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleColorableItem.cs Thu Oct 19 06:04:28 2006
@@ -9,7 +9,11 @@
{
class NemerleColorableItem : ColorableItem
{
- static readonly Color QuotationBackColor = Color.FromArgb(230, 237, 228);
+ static readonly Color[] QuotationBackColor = new Color[] {
+ Color.FromArgb(230, 237, 228), // Quotation
+ Color.FromArgb(240, 230, 220), // Quotation Verbatim String
+ Color.FromArgb(255, 210, 220) // Verbatim String
+ };
public NemerleColorableItem(string displayName)
: this(displayName, COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_USERTEXT_BK, Color.Empty, Color.Empty)
@@ -27,17 +31,17 @@
}
public NemerleColorableItem(string displayName, int n)
- : this(displayName, COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_SYSWIDGETMGN_BK, Color.Empty, QuotationBackColor)
+ : this(displayName, COLORINDEX.CI_SYSPLAINTEXT_FG, COLORINDEX.CI_SYSWIDGETMGN_BK, Color.Empty, QuotationBackColor[n])
{
}
public NemerleColorableItem(string displayName, int n, COLORINDEX foreColor)
- : this(displayName, foreColor, COLORINDEX.CI_SYSWIDGETMGN_BK, Color.Empty, QuotationBackColor)
+ : this(displayName, foreColor, COLORINDEX.CI_SYSWIDGETMGN_BK, Color.Empty, QuotationBackColor[n])
{
}
public NemerleColorableItem(string displayName, int n, COLORINDEX foreColor, Color hiForeColor)
- : this(displayName, foreColor, COLORINDEX.CI_SYSWIDGETMGN_BK, hiForeColor, QuotationBackColor)
+ : this(displayName, foreColor, COLORINDEX.CI_SYSWIDGETMGN_BK, hiForeColor, QuotationBackColor[n])
{
}
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs Thu Oct 19 06:04:28 2006
@@ -85,11 +85,15 @@
new NemerleColorableItem("Keyword", COLORINDEX.CI_BLUE),
new NemerleColorableItem("Comment", COLORINDEX.CI_DARKGREEN),
new NemerleColorableItem("Identifier"),
- new NemerleColorableItem("String", COLORINDEX.CI_MAROON, Color.FromArgb(163, 21, 21)),
+ new NemerleColorableItem("String", COLORINDEX.CI_MAROON, Color.FromArgb(170, 0, 0)),
new NemerleColorableItem("Number"),
new NemerleColorableItem("Text"),
+
new NemerleColorableItem("Operator"),
- new NemerleColorableItem("StringEx", COLORINDEX.CI_MAROON, Color.FromArgb(143, 44, 182)),
+ new NemerleColorableItem("Preprocessor Keyword", COLORINDEX.CI_BLUE, Color.FromArgb( 0, 51, 204)),
+ new NemerleColorableItem("StringEx", COLORINDEX.CI_MAROON, Color.FromArgb(225, 30, 30)),
+ new NemerleColorableItem("String (@ Verbatim)", 2, COLORINDEX.CI_MAROON, Color.FromArgb(170, 0, 0)),
+ new NemerleColorableItem("StringEx (@ Verbatim)", 2, COLORINDEX.CI_MAROON, Color.FromArgb(225, 30, 30)),
new NemerleColorableItem("Quotation", 0, COLORINDEX.CI_BROWN),
@@ -97,12 +101,12 @@
new NemerleColorableItem("<[ Keyword ]>", 0, COLORINDEX.CI_BLUE),
new NemerleColorableItem("<[ Comment ]>", 0, COLORINDEX.CI_DARKGREEN),
new NemerleColorableItem("<[ Identifier ]>", 0),
- new NemerleColorableItem("<[ String ]>", 0, COLORINDEX.CI_MAROON, Color.FromArgb(163, 21, 21)),
+ new NemerleColorableItem("<[ String ]>", 0, COLORINDEX.CI_MAROON, Color.FromArgb(170, 0, 0)),
new NemerleColorableItem("<[ Number ]>", 0),
new NemerleColorableItem("<[ Operator ]>", 0),
- new NemerleColorableItem("<[ StringEx ]>", 0, COLORINDEX.CI_MAROON, Color.FromArgb(143, 44, 182)),
-
- new NemerleColorableItem("Preprocessor Keyword", COLORINDEX.CI_BLUE, Color.FromArgb( 0, 0, 200)),
+ new NemerleColorableItem("<[ StringEx ]>", 0, COLORINDEX.CI_MAROON, Color.FromArgb(225, 30, 30)),
+ new NemerleColorableItem("<[ String (@) ]>", 1, COLORINDEX.CI_MAROON, Color.FromArgb(170, 0, 0)),
+ new NemerleColorableItem("<[ StringEx (@) ]>", 1, COLORINDEX.CI_MAROON, Color.FromArgb(225, 30, 30)),
};
public override void Dispose()
More information about the svn
mailing list