forked from PrismJS/prism
/
prism-wolfram.js
24 lines (23 loc) · 5.72 KB
/
prism-wolfram.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Prism.languages.wolfram = {
'comment': // Allow one level of nesting - note: regex taken from applescipt
/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,
'string': {
pattern: /"(?:\\.|[^"\\\r\n])*"/,
greedy: true
},
'keyword': /\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While|$Aborted|$ActivationGroupID|$ActivationKey|$ActivationUserRegistered|$AddOnsDirectory|$AllowDataUpdates|$AllowExternalChannelFunctions|$AllowInternet|$AssertFunction|$Assumptions|$AsynchronousTask|$AudioDecoders|$AudioEncoders|$AudioInputDevices|$AudioOutputDevices|$BaseDirectory|$BasePacletsDirectory|$BatchInput|$BatchOutput|$BlockchainBase|$BoxForms|$ByteOrdering|$CacheBaseDirectory|$Canceled|$ChannelBase|$CharacterEncoding|$CharacterEncodings|$CloudAccountName|$CloudBase|$CloudConnected|$CloudConnection|$CloudCreditsAvailable|$CloudEvaluation|$CloudExpressionBase|$CloudObjectNameFormat|$CloudObjectURLType|$CloudRootDirectory|$CloudSymbolBase|$CloudUserID|$CloudUserUUID|$CloudVersion|$CloudVersionNumber|$CloudWolframEngineVersionNumber|$CommandLine|$CompilationTarget|$CompilerEnvironment|$ConditionHold|$ConfiguredKernels|$Context|$ContextPath|$ControlActiveSetting|$Cookies|$CookieStore|$CreationDate|$CryptographicEllipticCurveNames|$CurrentLink|$CurrentTask|$CurrentWebSession|$DataStructures|$DateStringFormat|$DefaultAudioInputDevice|$DefaultAudioOutputDevice|$DefaultFont|$DefaultFrontEnd|$DefaultImagingDevice|$DefaultKernels|$DefaultLocalBase|$DefaultMailbox|$DefaultNetworkInterface|$DefaultPath|$DefaultProxyRules|$DefaultRemoteBatchSubmissionEnvironment|$DefaultRemoteKernel|$DefaultSystemCredentialStore|$devTextSearchOutput|$Display|$DisplayFunction|$DistributedContexts|$DynamicEvaluation|$Echo|$EmbedCodeEnvironments|$EmbeddableServices|$EntityStores|$Epilog|$EvaluationCloudBase|$EvaluationCloudObject|$EvaluationEnvironment|$ExportFormats|$ExternalIdentifierTypes|$ExternalStorageBase|$Failed|$FinancialDataSource|$FontFamilies|$FormatType|$FrontEnd|$FrontEndSession|$GeneratedAssetLocation|$GeoEntityTypes|$GeoLocation|$GeoLocationCity|$GeoLocationCountry|$GeoLocationPrecision|$GeoLocationSource|$HistoryLength|$HomeDirectory|$HTMLExportRules|$HTTPCookies|$HTTPRequest|$IgnoreEOF|$ImageFormattingWidth|$ImageResolution|$ImagingDevice|$ImagingDevices|$ImportFormats|$IncomingMailSettings|$InitialDirectory|$Initialization|$InitializationContexts|$Input|$InputFileName|$InputStreamMethods|$Inspector|$InstallationDate|$InstallationDirectory|$InterfaceEnvironment|$InterpreterTypes|$IterationLimit|$KernelCount|$KernelID|$Language|$LaunchDirectory|$LibraryPath|$LicenseExpirationDate|$LicenseID|$LicenseProcesses|$LicenseServer|$LicenseSubprocesses|$LicenseType|$Line|$Linked|$LinkSupported|$LoadedFiles|$LocalBase|$LocalSymbolBase|$MachineAddresses|$MachineDomain|$MachineDomains|$MachineEpsilon|$MachineID|$MachineName|$MachinePrecision|$MachineType|$MaxExtraPrecision|$MaxLicenseProcesses|$MaxLicenseSubprocesses|$MaxMachineNumber|$MaxNumber|$MaxPiecewiseCases|$MaxPrecision|$MaxRootDegree|$MessageGroups|$MessageList|$MessagePrePrint|$Messages|$MinMachineNumber|$MinNumber|$MinorReleaseNumber|$MinPrecision|$MobilePhone|$ModuleNumber|$NetworkConnected|$NetworkInterfaces|$NetworkLicense|$NewMessage|$NewOptimizations|$NewSymbol|$NotebookInlineStorageLimit|$Notebooks|$NoValue|$NumberMarks|$NumberOfExtraPages|$Off|$OperatingSystem|$Output|$OutputForms|$OutputSizeLimit|$OutputStreamMethods|$Packages|$ParentLink|$ParentProcessID|$PasswordFile|$PatchLevelID|$Path|$PathnameSeparator|$PerformanceGoal|$Permissions|$PermissionsGroupBase|$PersistenceBase|$PersistencePath|$PipeSupported|$PlotTheme|$Post|$Pre|$PreferencesDirectory|$PreInitialization|$PrePrint|$PreRead|$PrintForms|$PrintLiteral|$Printout3DPreviewer|$ProcessID|$ProcessorCount|$ProcessorType|$ProductInformation|$ProgramName|$ProgressReporting|$PublisherID|$RandomGeneratorState|$RandomState|$RecursionLimit|$RegisteredDeviceClasses|$RegisteredUserName|$ReleaseNumber|$RequesterAddress|$RequesterWolframID|$RequesterWolframUUID|$ResourceSystemBase|$ResourceSystemPath|$RootDirectory|$ScheduledTask|$ScriptCommandLine|$ScriptInputString|$SearchLanguage|$SecuredAuthenticationKeyTokens|$ServiceCreditsAvailable|$Services|$SessionID|$SetParentLink|$SharedFunctions|$SharedVariables|$SoundDisplay|$SoundDisplayFunction|$SourceLink|$SSHAuthentication|$SubtitleDecoders|$SubtitleEncoders|$SummaryBoxDataSizeLimit|$SuppressInputFormHeads|$SynchronousEvaluation|$SyntaxHandler|$System|$SystemCharacterEncoding|$SystemCredentialStore|$SystemID|$SystemMemory|$SystemShell|$SystemTimeZone|$SystemWordLength|$TargetSystems|$TemplatePath|$TemporaryDirectory|$TemporaryPrefix|$TestFileName|$TextStyle|$TimedOut|$TimeUnit|$TimeZone|$TimeZoneEntity|$TopDirectory|$TraceOff|$TraceOn|$TracePattern|$TracePostAction|$TracePreAction|$UnitSystem|$Urgent|$UserAddOnsDirectory|$UserAgentLanguages|$UserAgentMachine|$UserAgentName|$UserAgentOperatingSystem|$UserAgentString|$UserAgentVersion|$UserBaseDirectory|$UserBasePacletsDirectory|$UserDocumentsDirectory|$Username|$UserName|$UserURLBase|$Version|$VersionNumber|$VideoDecoders|$VideoEncoders|$VoiceStyles|$WolframDocumentsDirectory|$WolframID|$WolframUUID)\b/,
'context': {
pattern: /\w+`+\w*/,
alias: 'class-name'
},
'blank': {
pattern: /\b\w+\_{1,3}\b/,
alias: 'regex'
},
'boolean': /\b(?:True|False)\b/,
'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
'operator': /\/\.|\;|\=\.|\^\=|\^\:\=|\:\=|\<\<|\>\>|\<\||\|\>|\:\>|\|\-\>|\-\>|\<\-|\@\@\@|\@\@|\@|\/\@|\=\!\=|\=\=\=|\=\=|\=|\+|\-|\^|\*|\[\/-+%=]=?|\!\=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
'punctuation': /[\|{}[\];(),.:]/
};
Prism.languages.wl = Prism.languages.wolfram;
Prism.languages.mathematica = Prism.languages.wolfram;