function words(t){for(var e={},n=t.split(" "),T=0;T<n.length;++T)e[n[T]]=!0;return e}const parserConfig={name:"ttcn-cfg",keywords:words("Yes No LogFile FileMask ConsoleMask AppendFile TimeStampFormat LogEventTypes SourceInfoFormat LogEntityName LogSourceInfo DiskFullAction LogFileNumber LogFileSize MatchingHints Detailed Compact SubCategories Stack Single None Seconds DateTime Time Stop Error Retry Delete TCPPort KillTimer NumHCs UnixSocketsEnabled LocalAddress"),fileNCtrlMaskOptions:words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION TTCN_USER TTCN_FUNCTION TTCN_STATISTICS TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG EXECUTOR ERROR WARNING PORTEVENT TIMEROP VERDICTOP DEFAULTOP TESTCASE ACTION USER FUNCTION STATISTICS PARALLEL MATCHING DEBUG LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED DEBUG_ENCDEC DEBUG_TESTPORT DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED FUNCTION_RND FUNCTION_UNQUALIFIED MATCHING_DONE MATCHING_MCSUCCESS MATCHING_MCUNSUCC MATCHING_MMSUCCESS MATCHING_MMUNSUCC MATCHING_PCSUCCESS MATCHING_PCUNSUCC MATCHING_PMSUCCESS MATCHING_PMUNSUCC MATCHING_PROBLEM MATCHING_TIMEOUT MATCHING_UNQUALIFIED PARALLEL_PORTCONN PARALLEL_PORTMAP PARALLEL_PTC PARALLEL_UNQUALIFIED PORTEVENT_DUALRECV PORTEVENT_DUALSEND PORTEVENT_MCRECV PORTEVENT_MCSEND PORTEVENT_MMRECV PORTEVENT_MMSEND PORTEVENT_MQUEUE PORTEVENT_PCIN PORTEVENT_PCOUT PORTEVENT_PMIN PORTEVENT_PMOUT PORTEVENT_PQUEUE PORTEVENT_STATE PORTEVENT_UNQUALIFIED STATISTICS_UNQUALIFIED STATISTICS_VERDICT TESTCASE_FINISH TESTCASE_START TESTCASE_UNQUALIFIED TIMEROP_GUARD TIMEROP_READ TIMEROP_START TIMEROP_STOP TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED USER_UNQUALIFIED VERDICTOP_FINAL VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"),externalCommands:words("BeginControlPart EndControlPart BeginTestCase EndTestCase"),multiLineStrings:!0};var curPunc,keywords=parserConfig.keywords,fileNCtrlMaskOptions=parserConfig.fileNCtrlMaskOptions,externalCommands=parserConfig.externalCommands,multiLineStrings=parserConfig.multiLineStrings,isOperatorChar=/[\|]/;function tokenBase(t,e){var n=t.next();if('"'==n||"'"==n)return e.tokenize=tokenString(n),e.tokenize(t,e);if(/[:=]/.test(n))return curPunc=n,"punctuation";if("#"==n)return t.skipToEnd(),"comment";if(/\d/.test(n))return t.eatWhile(/[\w\.]/),"number";if(isOperatorChar.test(n))return t.eatWhile(isOperatorChar),"operator";if("["==n)return t.eatWhile(/[\w_\]]/),"number";t.eatWhile(/[\w\$_]/);var T=t.current();return keywords.propertyIsEnumerable(T)?"keyword":fileNCtrlMaskOptions.propertyIsEnumerable(T)?"atom":externalCommands.propertyIsEnumerable(T)?"deleted":"variable"}function tokenString(t){return function(e,n){for(var T,E=!1,r=!1;null!=(T=e.next());){if(T==t&&!E){var C=e.peek();C&&("b"!=(C=C.toLowerCase())&&"h"!=C&&"o"!=C||e.next()),r=!0;break}E=!E&&"\\"==T;}return (r||!E&&!multiLineStrings)&&(n.tokenize=null),"string"}}function Context(t,e,n,T,E){this.indented=t,this.column=e,this.type=n,this.align=T,this.prev=E;}function pushContext(t,e,n){var T=t.indented;return t.context&&"statement"==t.context.type&&(T=t.context.indented),t.context=new Context(T,e,n,null,t.context)}function popContext(t){var e=t.context.type;return ")"!=e&&"]"!=e&&"}"!=e||(t.indented=t.context.indented),t.context=t.context.prev}const ttcnCfg={startState:function(){return {tokenize:null,context:new Context(0,0,"top",!1),indented:0,startOfLine:!0}},token:function(t,e){var n=e.context;if(t.sol()&&(null==n.align&&(n.align=!1),e.indented=t.indentation(),e.startOfLine=!0),t.eatSpace())return null;curPunc=null;var T=(e.tokenize||tokenBase)(t,e);if("comment"==T)return T;if(null==n.align&&(n.align=!0),";"!=curPunc&&":"!=curPunc&&","!=curPunc||"statement"!=n.type)if("{"==curPunc)pushContext(e,t.column(),"}");else if("["==curPunc)pushContext(e,t.column(),"]");else if("("==curPunc)pushContext(e,t.column(),")");else if("}"==curPunc){for(;"statement"==n.type;)n=popContext(e);for("}"==n.type&&(n=popContext(e));"statement"==n.type;)n=popContext(e);}else curPunc==n.type?popContext(e):(("}"==n.type||"top"==n.type)&&";"!=curPunc||"statement"==n.type&&"newstatement"==curPunc)&&pushContext(e,t.column(),"statement");else popContext(e);return e.startOfLine=!1,T},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:"#"}}};

export { ttcnCfg };
