Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for preprocessing and compiler directives

  • Loading branch information...
commit 0ebc6522b3933ade8532ffa2ecb39118d48b2a25 1 parent a4ae88d
@OkayX6 OkayX6 authored
View
52 src/fsharper/Psi.FSharp/src/Parsing/FSharpLexer.gen.lex
@@ -145,7 +145,6 @@ END_LINE={NOT_NEW_LINE}*(({PP_NEW_LINE_PAIR})|({PP_NEW_LINE_CHAR}))
PP_MESSAGE={INPUT_CHARACTER}*
-%state PPSHARP
%state PPSYMBOL
%state PPDIGITS
%state PPMESSAGE
@@ -241,7 +240,7 @@ PP_MESSAGE={INPUT_CHARACTER}*
<YYINITIAL> ">=" { currTokenType = makeToken(FSharpTokenType.GREATER_EQUALS); return currTokenType; }
<YYINITIAL> ">>" { currTokenType = makeToken(FSharpTokenType.GREATER_GREATER); return currTokenType; }
<YYINITIAL> "<<" { currTokenType = makeToken(FSharpTokenType.LESS_LESS); return currTokenType; }
-
+<YYINITIAL> "#" { currTokenType = makeToken(FSharpTokenType.HASH); return currTokenType; }
<YYINITIAL> "{" { return makeToken(FSharpTokenType.LBRACE); }
<YYINITIAL> "}" { return makeToken(FSharpTokenType.RBRACE); }
@@ -279,27 +278,26 @@ PP_MESSAGE={INPUT_CHARACTER}*
<YYINITIAL> . { currTokenType = makeToken(FSharpTokenType.BAD_CHARACTER); return currTokenType; }
-<PPSHARP, PPSYMBOL, PPDIGITS, PPMESSAGE> {WHITE_SPACE} { return makeToken (FSharpTokenType.WHITE_SPACE); }
-
-<PPSHARP> "undef" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_UNDEF_DECLARATION); }
-<PPSHARP> "define" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_DEFINE_DECLARATION); }
-<PPSHARP> "if" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_IF_SECTION); }
-<PPSHARP> "elif" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_ELIF_SECTION); }
-<PPSHARP> "else" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_ELSE_SECTION); }
-<PPSHARP> "endif" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_ENDIF); }
-<PPSHARP> "error" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_ERROR_DIAGNOSTIC); }
-<PPSHARP> "warning" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_WARNING_DIAGNOSTIC); }
-<PPSHARP> "region" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_START_REGION); }
-<PPSHARP> "endregion" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_END_REGION); }
-<PPSHARP> "line" { yybegin(PPDIGITS); return makeToken(FSharpTokenType.PP_LINE); }
-<PPSHARP> "pragma" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_PRAGMA); }
-<PPSHARP> "r" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_R); }
-<PPSHARP> "q" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_Q); }
-<PPSHARP> "i" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_I); }
-<PPSHARP> "help" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_HELP); }
-<PPSHARP> "load" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_LOAD); }
-<PPSHARP> "light" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_LIGHT); }
-<PPSHARP> "line" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_LINE); }
+<PPSYMBOL, PPDIGITS, PPMESSAGE> {WHITE_SPACE} { return makeToken (FSharpTokenType.WHITE_SPACE); }
+
+<YYINITIAL> "#undef" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_UNDEF_DECLARATION); }
+<YYINITIAL> "#define" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_DEFINE_DECLARATION); }
+<YYINITIAL> "#if" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_IF_SECTION); }
+<YYINITIAL> "#elif" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_ELIF_SECTION); }
+<YYINITIAL> "#else" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_ELSE_SECTION); }
+<YYINITIAL> "#endif" { yybegin(PPSYMBOL); return makeToken(FSharpTokenType.PP_ENDIF); }
+<YYINITIAL> "#line" { yybegin(PPDIGITS); return makeToken(FSharpTokenType.PP_LINE); }
+<YYINITIAL> "#nowarn" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_NO_WARN); }
+<YYINITIAL> "#r" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_R); }
+<YYINITIAL> "#reference" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_REFERENCE); }
+<YYINITIAL> "#q" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_Q); }
+<YYINITIAL> "#quit" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_QUIT); }
+<YYINITIAL> "#I" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_I); }
+<YYINITIAL> "#Include" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_INCLUDE); }
+<YYINITIAL> "#help" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_HELP); }
+<YYINITIAL> "#load" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_LOAD); }
+<YYINITIAL> "#light" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_LIGHT); }
+<YYINITIAL> "#time" { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_TIME); }
<PPSYMBOL> "||" { return makeToken(FSharpTokenType.PP_OR); }
<PPSYMBOL> "&&" { return makeToken(FSharpTokenType.PP_AND); }
@@ -322,11 +320,9 @@ PP_MESSAGE={INPUT_CHARACTER}*
<PPMESSAGE> {PP_MESSAGE} { return makeToken(FSharpTokenType.PP_MESSAGE); }
-<PPSHARP, PPSYMBOL, PPDIGITS, PPMESSAGE> {SINGLE_LINE_COMMENT} { return makeToken(FSharpTokenType.END_OF_LINE_COMMENT); }
-<PPSHARP, PPSYMBOL, PPDIGITS, PPMESSAGE> {NEW_LINE_PAIR} { yybegin(YYINITIAL); return makeToken(FSharpTokenType.NEW_LINE); }
-<PPSHARP, PPSYMBOL, PPDIGITS, PPMESSAGE> {NEW_LINE_CHAR} { yybegin(YYINITIAL); return makeToken(FSharpTokenType.NEW_LINE); }
+<PPSYMBOL, PPDIGITS, PPMESSAGE> {SINGLE_LINE_COMMENT} { return makeToken(FSharpTokenType.END_OF_LINE_COMMENT); }
+<PPSYMBOL, PPDIGITS, PPMESSAGE> {NEW_LINE_PAIR} { yybegin(YYINITIAL); return makeToken(FSharpTokenType.NEW_LINE); }
+<PPSYMBOL, PPDIGITS, PPMESSAGE> {NEW_LINE_CHAR} { yybegin(YYINITIAL); return makeToken(FSharpTokenType.NEW_LINE); }
-<PPSHARP> {PP_BAD_DIRECTIVE} { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_BAD_DIRECTIVE); }
<YYINITIAL> . { return makeToken(FSharpTokenType.BAD_CHARACTER); }
-<PPSHARP> . { yybegin(PPMESSAGE); return makeToken(FSharpTokenType.PP_BAD_DIRECTIVE); }
<PPSYMBOL, PPDIGITS, PPMESSAGE> . { return makeToken(FSharpTokenType.PP_BAD_CHARACTER); }
View
20,499 src/fsharper/Psi.FSharp/src/Parsing/FSharpLexer.gen_lex.cs
10,273 additions, 10,226 deletions not shown
View
5 src/fsharper/Psi.FSharp/src/Parsing/FSharpTokenType.cs
@@ -377,15 +377,10 @@ static FSharpTokenType()
PP_QUIT,
PP_I,
PP_HELP,
- PP_ERROR_DIAGNOSTIC,
- PP_WARNING_DIAGNOSTIC,
- PP_START_REGION,
- PP_END_REGION,
PP_LINE,
PP_LIGHT,
PP_LOAD,
PP_COMMA,
- PP_PRAGMA,
PP_OR,
PP_AND,
PP_EQU,
View
135 src/fsharper/Psi.FSharp/src/Parsing/FSharpTokenTypeGenerated.cs
@@ -3134,6 +3134,21 @@ private class PpRTokenElement : FixedTokenElement
}
public static readonly TokenNodeType PP_R = new PpRNodeType();
#endregion
+ #region PP_REFERENCE
+ private class PpReferenceNodeType : FixedTokenNodeType
+ {
+ public PpReferenceNodeType() : base("PP_REFERENCE", "reference") { }
+ public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
+ {
+ return new PpReferenceTokenElement(this);
+ }
+ }
+ private class PpReferenceTokenElement : FixedTokenElement
+ {
+ public PpReferenceTokenElement(PpReferenceNodeType tokenNodeType) : base(tokenNodeType) { }
+ }
+ public static readonly TokenNodeType PP_REFERENCE = new PpReferenceNodeType();
+ #endregion
#region PP_Q
private class PpQNodeType : FixedTokenNodeType
{
@@ -3179,6 +3194,21 @@ private class PpITokenElement : FixedTokenElement
}
public static readonly TokenNodeType PP_I = new PpINodeType();
#endregion
+ #region PP_INCLUDE
+ private class PpIncludeNodeType : FixedTokenNodeType
+ {
+ public PpIncludeNodeType() : base("PP_INCLUDE", "Include") { }
+ public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
+ {
+ return new PpIncludeTokenElement(this);
+ }
+ }
+ private class PpIncludeTokenElement : FixedTokenElement
+ {
+ public PpIncludeTokenElement(PpIncludeNodeType tokenNodeType) : base(tokenNodeType) { }
+ }
+ public static readonly TokenNodeType PP_INCLUDE = new PpIncludeNodeType();
+ #endregion
#region PP_HELP
private class PpHelpNodeType : FixedTokenNodeType
{
@@ -3194,66 +3224,6 @@ private class PpHelpTokenElement : FixedTokenElement
}
public static readonly TokenNodeType PP_HELP = new PpHelpNodeType();
#endregion
- #region PP_ERROR_DIAGNOSTIC
- private class PpErrorDiagnosticNodeType : FixedTokenNodeType
- {
- public PpErrorDiagnosticNodeType(): base ("PP_ERROR_DIAGNOSTIC", "error") {}
- public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
- {
- return new PpErrorDiagnosticTokenElement(this);
- }
- }
- private class PpErrorDiagnosticTokenElement : FixedTokenElement
- {
- public PpErrorDiagnosticTokenElement(PpErrorDiagnosticNodeType tokenNodeType) : base(tokenNodeType) { }
- }
- public static readonly TokenNodeType PP_ERROR_DIAGNOSTIC = new PpErrorDiagnosticNodeType();
- #endregion
- #region PP_WARNING_DIAGNOSTIC
- private class PpWarningDiagnosticNodeType : FixedTokenNodeType
- {
- public PpWarningDiagnosticNodeType(): base ("PP_WARNING_DIAGNOSTIC", "warning") {}
- public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
- {
- return new PpWarningDiagnosticTokenElement(this);
- }
- }
- private class PpWarningDiagnosticTokenElement : FixedTokenElement
- {
- public PpWarningDiagnosticTokenElement(PpWarningDiagnosticNodeType tokenNodeType) : base(tokenNodeType) { }
- }
- public static readonly TokenNodeType PP_WARNING_DIAGNOSTIC = new PpWarningDiagnosticNodeType();
- #endregion
- #region PP_START_REGION
- private class PpStartRegionNodeType : FixedTokenNodeType
- {
- public PpStartRegionNodeType(): base ("PP_START_REGION", "region") {}
- public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
- {
- return new PpStartRegionTokenElement(this);
- }
- }
- private class PpStartRegionTokenElement : FixedTokenElement
- {
- public PpStartRegionTokenElement(PpStartRegionNodeType tokenNodeType) : base(tokenNodeType) { }
- }
- public static readonly TokenNodeType PP_START_REGION = new PpStartRegionNodeType();
- #endregion
- #region PP_END_REGION
- private class PpEndRegionNodeType : FixedTokenNodeType
- {
- public PpEndRegionNodeType(): base ("PP_END_REGION", "endregion") {}
- public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
- {
- return new PpEndRegionTokenElement(this);
- }
- }
- private class PpEndRegionTokenElement : FixedTokenElement
- {
- public PpEndRegionTokenElement(PpEndRegionNodeType tokenNodeType) : base(tokenNodeType) { }
- }
- public static readonly TokenNodeType PP_END_REGION = new PpEndRegionNodeType();
- #endregion
#region PP_LINE
private class PpLineNodeType : FixedTokenNodeType
{
@@ -3284,6 +3254,36 @@ private class PpLightTokenElement : FixedTokenElement
}
public static readonly TokenNodeType PP_LIGHT = new PpLightNodeType();
#endregion
+ #region PP_NO_WARN
+ private class PpNoWarnNodeType : FixedTokenNodeType
+ {
+ public PpNoWarnNodeType() : base("PP_NO_WARN", "no warn") { }
+ public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
+ {
+ return new PpNoWarnTokenElement(this);
+ }
+ }
+ private class PpNoWarnTokenElement : FixedTokenElement
+ {
+ public PpNoWarnTokenElement(PpNoWarnNodeType tokenNodeType) : base(tokenNodeType) { }
+ }
+ public static readonly TokenNodeType PP_NO_WARN = new PpNoWarnNodeType();
+ #endregion
+ #region PP_TIME
+ private class PpTimeNodeType : FixedTokenNodeType
+ {
+ public PpTimeNodeType() : base("PP_TIME", "time") { }
+ public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
+ {
+ return new PpTimeTokenElement(this);
+ }
+ }
+ private class PpTimeTokenElement : FixedTokenElement
+ {
+ public PpTimeTokenElement(PpTimeNodeType tokenNodeType) : base(tokenNodeType) { }
+ }
+ public static readonly TokenNodeType PP_TIME = new PpTimeNodeType();
+ #endregion
#region PP_LOAD
private class PpLoadNodeType : FixedTokenNodeType
{
@@ -3314,21 +3314,6 @@ private class PpCommaTokenElement : FixedTokenElement
}
public static readonly TokenNodeType PP_COMMA = new PpCommaNodeType();
#endregion
- #region PP_PRAGMA
- private class PpPragmaNodeType : FixedTokenNodeType
- {
- public PpPragmaNodeType(): base ("PP_PRAGMA", "pragma") {}
- public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
- {
- return new PpPragmaTokenElement(this);
- }
- }
- private class PpPragmaTokenElement : FixedTokenElement
- {
- public PpPragmaTokenElement(PpPragmaNodeType tokenNodeType) : base(tokenNodeType) { }
- }
- public static readonly TokenNodeType PP_PRAGMA = new PpPragmaNodeType();
- #endregion
#region PP_OR
private class PpOrNodeType : FixedTokenNodeType
{
Please sign in to comment.
Something went wrong with that request. Please try again.