248e03dca3
- backport to fix non reachable links and redirected links in documentation
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
commit 14a0bcc74a121525917aefc8c9034e283e94884b
|
|
Author: Piotr Szydełko <wiertel@wiertel.info>
|
|
Date: Sat May 20 08:14:27 2017 +0200
|
|
|
|
Fix C# property initializer parsing
|
|
|
|
int Property {get; set;} = 23;
|
|
The parser was ending the property at the closing bracket,
|
|
which resulted in the initializer being assigned to the following property.
|
|
|
|
diff --git a/src/scanner.l b/src/scanner.l
|
|
index 9ff082d4..632c8a51 100644
|
|
--- a/src/scanner.l
|
|
+++ b/src/scanner.l
|
|
@@ -6198,6 +6198,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
|
|
}
|
|
}
|
|
<CSAccessorDecl>"{" { curlyCount++; }
|
|
+<CSAccessorDecl>"}"{B}*"=" {
|
|
+ // fall back to next rule if it's not the right bracket
|
|
+ if (curlyCount != 0) REJECT;
|
|
+ current->initializer = "=";
|
|
+ current->endBodyLine=yyLineNr;
|
|
+ lastInitializerContext = FindMembers;
|
|
+ BEGIN(ReadInitializer);
|
|
+ }
|
|
<CSAccessorDecl>"}" {
|
|
if (curlyCount)
|
|
{
|
|
@@ -6207,6 +6215,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
|
|
{
|
|
mtype = Method;
|
|
virt = Normal;
|
|
+ // not really important, but while we are at it
|
|
+ current->endBodyLine=yyLineNr;
|
|
unput(';');
|
|
BEGIN(FindMembers);
|
|
}
|