@@ -104,6 +104,9 @@ Term ::= ... | '(' '?' '=' Disjunction ')' [removed] | '(' '?' '!' Disjunction '
104104
105105namespace UnifiedRegex
106106{
107+ template <typename P, const bool IsLiteral>
108+ const CharCount Parser<P, IsLiteral>::initLitbufSize;
109+
107110 ParseError::ParseError (bool isBody, CharCount pos, CharCount encodedPos, HRESULT error)
108111 : isBody(isBody), pos(pos), encodedPos(encodedPos), error(error)
109112 {
@@ -3055,45 +3058,20 @@ namespace UnifiedRegex
30553058 }
30563059 }
30573060
3058- //
3059- // Template instantiation
3060- //
3061-
3062- template <typename P, const bool IsLiteral>
3063- void UnifiedRegexParserForceInstantiation ()
3064- {
3065- typedef typename P::EncodedChar EncodedChar;
3066- Parser<P, IsLiteral> p
3067- ( 0
3068- , 0
3069- , 0
3070- , 0
3071- , false
3072- #if ENABLE_REGEX_CONFIG_OPTIONS
3073- , 0
3074- #endif
3075- );
3076-
3077- RegexFlags f;
3078- CharCount a, b, c, d;
3079- const EncodedChar* cp = 0 ;
3080- p.ParseDynamic (0 , 0 , 0 , 0 , f);
3081- p.ParseLiteral (0 , 0 , a, b, c, d, f);
3082- p.ParseLiteralNoAST (0 , 0 , a, b, c, d);
3083- p.template CompileProgram <true >(0 , cp, a, b, c, f);
3084- p.template CompileProgram <false >(0 , cp, a, b, c, f);
3085- p.CaptureEmptySourceAndNoGroups (0 );
3086- p.CaptureSourceAndGroups (0 , 0 , 0 , 0 );
3087- p.FreeBody ();
3088- }
3089-
3090- void UnifiedRegexParserForceAllInstantiations ()
3091- {
3092- UnifiedRegexParserForceInstantiation<NullTerminatedUnicodeEncodingPolicy, false >();
3093- UnifiedRegexParserForceInstantiation<NullTerminatedUnicodeEncodingPolicy, true >();
3094- UnifiedRegexParserForceInstantiation<NullTerminatedUTF8EncodingPolicy, false >();
3095- UnifiedRegexParserForceInstantiation<NullTerminatedUTF8EncodingPolicy, true >();
3096- UnifiedRegexParserForceInstantiation<NotNullTerminatedUTF8EncodingPolicy, false >();
3097- UnifiedRegexParserForceInstantiation<NotNullTerminatedUTF8EncodingPolicy, true >();
3098- }
3061+ // Instantiate all templates
3062+ #define INSTANTIATE_REGEX_PARSER_COMPILE (EncodingPolicy, IsLiteral, BuildAST ) \
3063+ template RegexPattern* Parser<EncodingPolicy, IsLiteral>::CompileProgram<BuildAST>(Node* root, const EncodedChar*& currentCharacter, const CharCount totalLen, const CharCount bodyChars, const CharCount totalChars, const RegexFlags flags );
3064+
3065+ #define INSTANTIATE_REGEX_PARSER (EncodingPolicy ) \
3066+ INSTANTIATE_REGEX_PARSER_COMPILE (EncodingPolicy, false , false ) \
3067+ INSTANTIATE_REGEX_PARSER_COMPILE (EncodingPolicy, false , true ) \
3068+ INSTANTIATE_REGEX_PARSER_COMPILE (EncodingPolicy, true , false ) \
3069+ INSTANTIATE_REGEX_PARSER_COMPILE (EncodingPolicy, true , true ) \
3070+ template class Parser <EncodingPolicy, false >; \
3071+ template class Parser <EncodingPolicy, true >;
3072+
3073+ // Instantiate the Parser
3074+ INSTANTIATE_REGEX_PARSER (NullTerminatedUnicodeEncodingPolicy);
3075+ INSTANTIATE_REGEX_PARSER (NullTerminatedUTF8EncodingPolicy);
3076+ INSTANTIATE_REGEX_PARSER (NotNullTerminatedUTF8EncodingPolicy);
30993077}
0 commit comments