Class: Rouge::Lexers::Powershell

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/powershell.rb

Constant Summary collapse

ATTRIBUTES =
%w(
  ConfirmImpact DefaultParameterSetName HelpURI PositionalBinding
  SupportsPaging SupportsShouldProcess
)
AUTO_VARS =
%w(
  \$\$ \$\? \$\^ \$_
  \$args \$ConsoleFileName \$Error \$Event \$EventArgs \$EventSubscriber
  \$ExecutionContext \$false \$foreach \$HOME \$Host \$input \$IsCoreCLR
  \$IsLinux \$IsMacOS \$IsWindows \$LastExitCode \$Matches \$MyInvocation
  \$NestedPromptLevel \$null \$PID \$PROFILE \$PSBoundParameters \$PSCmdlet
  \$PSCommandPath \$PSCulture \$PSDebugContext \$PSHOME \$PSItem
  \$PSScriptRoot \$PSSenderInfo \$PSUICulture \$PSVersionTable \$PWD
  \$REPORTERRORSHOWEXCEPTIONCLASS \$REPORTERRORSHOWINNEREXCEPTION
  \$REPORTERRORSHOWSOURCE \$REPORTERRORSHOWSTACKTRACE
  \$SENDER \$ShellId \$StackTrace \$switch \$this \$true
).join('|')
KEYWORDS =
%w(
  assembly exit process base filter public begin finally return break for
  sequence catch foreach static class from switch command function throw
  configuration hidden trap continue if try data in type define
  inlinescript until do interface using dynamicparam module var else
  namespace while elseif parallel workflow end param enum private
).join('|')
KEYWORDS_TYPE =

devblogs.microsoft.com/scripting/powertip-find-a-list-of-powershell-type-accelerators/ ([PSObject].Assembly.GetType(“System.Management.Automation.TypeAccelerators”)::Get).Keys -join ‘ ’

%w(
  Alias AllowEmptyCollection AllowEmptyString AllowNull ArgumentCompleter
  array bool byte char CmdletBinding datetime decimal double DscResource
  float single guid hashtable int int32 int16 long int64 ciminstance
  cimclass cimtype cimconverter IPEndpoint NullString OutputType
  ObjectSecurity Parameter PhysicalAddress pscredential PSDefaultValue
  pslistmodifier psobject pscustomobject psprimitivedictionary ref
  PSTypeNameAttribute regex DscProperty sbyte string SupportsWildcards
  switch cultureinfo bigint securestring timespan uint16 uint32 uint64
  uri ValidateCount ValidateDrive ValidateLength ValidateNotNull
  ValidateNotNullOrEmpty ValidatePattern ValidateRange ValidateScript
  ValidateSet ValidateTrustedData ValidateUserDrive version void
  ipaddress DscLocalConfigurationManager WildcardPattern X509Certificate
  X500DistinguishedName xml CimSession adsi adsisearcher wmiclass wmi
  wmisearcher mailaddress scriptblock psvariable type psmoduleinfo
  powershell runspacefactory runspace initialsessionstate psscriptmethod
  psscriptproperty psnoteproperty psaliasproperty psvariableproperty
).join('|')
OPERATORS =
%w(
  -split -isplit -csplit -join -is -isnot -as -eq -ieq -ceq -ne -ine -cne
  -gt -igt -cgt -ge -ige -cge -lt -ilt -clt -le -ile -cle -like -ilike
  -clike -notlike -inotlike -cnotlike -match -imatch -cmatch -notmatch
  -inotmatch -cnotmatch -contains -icontains -ccontains -notcontains
  -inotcontains -cnotcontains -replace -ireplace -creplace -shl -shr -band
  -bor -bxor -and -or -xor -not \+= -= \*= \/= %=
).join('|')
MULTILINE_KEYWORDS =
%w(
  synopsis description parameter example inputs outputs notes link
  component role functionality forwardhelptargetname forwardhelpcategory
  remotehelprunspace externalhelp
).join('|')

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Method Summary

Methods inherited from RegexLexer

append, #delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, #state, state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, assert_utf8!, #bool_option, #continue_lex, continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer