fix mono 3.12.1 stack overflow on ubuntu with 60k+ string concat expression #2

This commit is contained in:
Eric Vergnaud 2015-09-19 02:30:13 +08:00
parent 7743e44517
commit 2f082e29fc
1 changed files with 8 additions and 13 deletions

View File

@ -931,6 +931,7 @@ namespace <file.genPackage> {
<endif>
<namedActions.header>
using System;
using System.Text;
using Antlr4.Runtime;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Misc;
@ -986,19 +987,13 @@ public partial class <csIdentifier.(lexer.name)> : <superClass; null="Lexer"> {
SerializedATN(model) ::= <<
<if(rest(model.segments))>
<! requires segmented representation on Ubuntu mono 3.12.1 !>
<model.segments:{segment|private static final String _serializedATNSegment<i0> =
"<segment; wrap={"+<\n><\t>"}>";}; separator="\n">
public static readonly string _serializedATN = string.join( "",
new string[] {
<model.segments:{segment | _serializedATNSegment<i0>}; separator=",\n">
}, 0, <length(model.segments)>);
<else>
<! only one segment, can be inlined !>
public static readonly string _serializedATN =
"<model.serialized; wrap={"+<\n><\t>"}>";
<endif>
private static string _serializedATN = _serializeATN();
private static string _serializeATN()
{
StringBuilder sb = new StringBuilder();
sb.Append("<model.serialized; wrap={");<\n><\t>sb.Append("}>");
return sb.ToString();
}
public static readonly ATN _ATN =
new ATNDeserializer().Deserialize(_serializedATN.ToCharArray());