geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

geany_powershell.c File Reference
#include "general.h"
#include "debug.h"
#include "parse.h"
#include "read.h"
#include "vstring.h"
#include "keyword.h"
#include "entry.h"
#include "routines.h"
#include <string.h>
Include dependency graph for geany_powershell.c:

Go to the source code of this file.

Classes

struct  tokenInfo
 

Macros

#define SCOPE_SEPARATOR   "::"
 
#define ACCESS_UNDEFINED   NULL
 

Typedefs

typedef enum eTokenType tokenType
 

Enumerations

enum  powerShellKind { K_FUNCTION , K_VARIABLE , COUNT_KIND }
 
enum  eTokenType {
  TOKEN_OPEN_CURLY = '{' , TOKEN_UNDEFINED = 256 , TOKEN_KEYWORD , TOKEN_IDENTIFIER ,
  TOKEN_NONE , TOKEN_ARGS , TOKEN_BRACE_CLOSE , TOKEN_BRACE_OPEN ,
  TOKEN_COMMA , TOKEN_DOUBLE_COLON , TOKEN_KEYWORD , TOKEN_NAME ,
  TOKEN_PACKAGE , TOKEN_PAREN_NAME , TOKEN_SEMICOLON , TOKEN_SPEC ,
  TOKEN_STAR , TOKEN_ARRAY , TOKEN_COUNT , TOKEN_UNDEFINED ,
  TOKEN_EOF , TOKEN_CHARACTER , TOKEN_CLOSE_PAREN , TOKEN_SEMICOLON ,
  TOKEN_COLON , TOKEN_COMMA , TOKEN_KEYWORD , TOKEN_OPEN_PAREN ,
  TOKEN_IDENTIFIER , TOKEN_STRING , TOKEN_PERIOD , TOKEN_OPEN_CURLY ,
  TOKEN_CLOSE_CURLY , TOKEN_EQUAL_SIGN , TOKEN_EXCLAMATION , TOKEN_FORWARD_SLASH ,
  TOKEN_OPEN_SQUARE , TOKEN_CLOSE_SQUARE , TOKEN_OPEN_MXML , TOKEN_CLOSE_MXML ,
  TOKEN_CLOSE_SGML , TOKEN_LESS_THAN , TOKEN_GREATER_THAN , TOKEN_QUESTION_MARK ,
  TOKEN_OPEN_NAMESPACE , TOKEN_POSTFIX_OPERATOR , TOKEN_STAR , TOKEN_BINARY_OPERATOR ,
  TOKEN_UNDEFINED , TOKEN_COMMA , TOKEN_DOUBLE_COLON , TOKEN_IDENTIFIER ,
  TOKEN_KEYWORD , TOKEN_LABEL , TOKEN_NUMERIC , TOKEN_OPERATOR ,
  TOKEN_PAREN_CLOSE , TOKEN_PAREN_OPEN , TOKEN_SQUARE_CLOSE , TOKEN_SQUARE_OPEN ,
  TOKEN_PERCENT , TOKEN_STATEMENT_END , TOKEN_STRING , TOKEN_NONE = -1 ,
  TOKEN_OTHER , TOKEN_KEYWORD , TOKEN_IDENTIFIER , TOKEN_STRING ,
  TOKEN_OPEN_PAREN , TOKEN_CLOSE_PAREN , TOKEN_OPEN_CURLY , TOKEN_CLOSE_CURLY ,
  TOKEN_OPEN_SQUARE , TOKEN_CLOSE_SQUARE , TOKEN_SEMICOLON , TOKEN_STAR ,
  TOKEN_LEFT_ARROW , TOKEN_DOT , TOKEN_COMMA , TOKEN_EOF ,
  TOKEN_UNDEFINED , TOKEN_EOF , TOKEN_CHARACTER , TOKEN_CLOSE_PAREN ,
  TOKEN_SEMICOLON , TOKEN_COLON , TOKEN_COMMA , TOKEN_KEYWORD ,
  TOKEN_OPEN_PAREN , TOKEN_IDENTIFIER , TOKEN_STRING , TOKEN_TEMPLATE_STRING ,
  TOKEN_PERIOD , TOKEN_OPEN_CURLY , TOKEN_CLOSE_CURLY , TOKEN_EQUAL_SIGN ,
  TOKEN_OPEN_SQUARE , TOKEN_CLOSE_SQUARE , TOKEN_REGEXP , TOKEN_POSTFIX_OPERATOR ,
  TOKEN_STAR , TOKEN_BINARY_OPERATOR , TOKEN_UNDEFINED , TOKEN_EOF ,
  TOKEN_CHARACTER , TOKEN_CLOSE_PAREN , TOKEN_SEMICOLON , TOKEN_COLON ,
  TOKEN_COMMA , TOKEN_KEYWORD , TOKEN_OPEN_PAREN , TOKEN_OPERATOR ,
  TOKEN_IDENTIFIER , TOKEN_STRING , TOKEN_PERIOD , TOKEN_OPEN_CURLY ,
  TOKEN_CLOSE_CURLY , TOKEN_EQUAL_SIGN , TOKEN_OPEN_SQUARE , TOKEN_CLOSE_SQUARE ,
  TOKEN_VARIABLE , TOKEN_AMPERSAND , TOKEN_UNDEFINED , TOKEN_EOF ,
  TOKEN_CLOSE_PAREN , TOKEN_SEMICOLON , TOKEN_COLON , TOKEN_COMMA ,
  TOKEN_KEYWORD , TOKEN_OPEN_PAREN , TOKEN_OPERATOR , TOKEN_IDENTIFIER ,
  TOKEN_STRING , TOKEN_PERIOD , TOKEN_OPEN_CURLY , TOKEN_CLOSE_CURLY ,
  TOKEN_EQUAL_SIGN , TOKEN_OPEN_SQUARE , TOKEN_CLOSE_SQUARE , TOKEN_VARIABLE ,
  TOKEN_UNDEFINED , TOKEN_BLOCK_LABEL_BEGIN , TOKEN_BLOCK_LABEL_END , TOKEN_CHARACTER ,
  TOKEN_CLOSE_PAREN , TOKEN_COLON , TOKEN_SEMICOLON , TOKEN_COMMA ,
  TOKEN_IDENTIFIER , TOKEN_KEYWORD , TOKEN_OPEN_PAREN , TOKEN_OPERATOR ,
  TOKEN_OTHER , TOKEN_STRING , TOKEN_PERIOD , TOKEN_OPEN_CURLY ,
  TOKEN_CLOSE_CURLY , TOKEN_OPEN_SQUARE , TOKEN_CLOSE_SQUARE , TOKEN_TILDE ,
  TOKEN_FORWARD_SLASH , TOKEN_EQUAL
}
 

Functions

static const char * findValidAccessType (const char *const access)
 
static void initPowerShellEntry (tagEntryInfo *const e, const tokenInfo *const token, const powerShellKind kind, const char *const access)
 
static void makeSimplePowerShellTag (const tokenInfo *const token, const powerShellKind kind, const char *const access)
 
static void makeFunctionTag (const tokenInfo *const token, const vString *const arglist, const char *const access)
 
static tokenInfonewToken (void)
 
static void deleteToken (tokenInfo *const token)
 
static void copyToken (tokenInfo *const dest, const tokenInfo *const src, bool scope)
 
static void addToScope (tokenInfo *const token, const vString *const extra)
 
static bool isIdentChar (const int c)
 
static void parseString (vString *const string, const int delimiter)
 
static void parseIdentifier (vString *const string, const int firstChar)
 
static bool isTokenFunction (vString *const name)
 
static bool isSpace (int c)
 
static int skipWhitespaces (int c)
 
static int skipSingleComment (void)
 
static void readToken (tokenInfo *const token)
 
static void enterScope (tokenInfo *const parentToken, const vString *const extraScope, const int parentKind)
 
static const char * parsePowerShellScope (tokenInfo *const token)
 
static bool parseFunction (tokenInfo *const token)
 
static bool parseVariable (tokenInfo *const token)
 
static void findPowerShellTags (void)
 
parserDefinitionPowerShellParser (void)
 

Variables

static const char *const accessTypes []
 
static kindDefinition PowerShellKinds [COUNT_KIND]
 

Macro Definition Documentation

◆ ACCESS_UNDEFINED

#define ACCESS_UNDEFINED   NULL

Definition at line 29 of file geany_powershell.c.

◆ SCOPE_SEPARATOR

#define SCOPE_SEPARATOR   "::"

Definition at line 26 of file geany_powershell.c.

Typedef Documentation

◆ tokenType

typedef enum eTokenType tokenType

Enumeration Type Documentation

◆ eTokenType

enum eTokenType
Enumerator
TOKEN_OPEN_CURLY 
TOKEN_UNDEFINED 
TOKEN_KEYWORD 
TOKEN_IDENTIFIER 
TOKEN_NONE 
TOKEN_ARGS 
TOKEN_BRACE_CLOSE 
TOKEN_BRACE_OPEN 
TOKEN_COMMA 
TOKEN_DOUBLE_COLON 
TOKEN_KEYWORD 
TOKEN_NAME 
TOKEN_PACKAGE 
TOKEN_PAREN_NAME 
TOKEN_SEMICOLON 
TOKEN_SPEC 
TOKEN_STAR 
TOKEN_ARRAY 
TOKEN_COUNT 
TOKEN_UNDEFINED 
TOKEN_EOF 
TOKEN_CHARACTER 
TOKEN_CLOSE_PAREN 
TOKEN_SEMICOLON 
TOKEN_COLON 
TOKEN_COMMA 
TOKEN_KEYWORD 
TOKEN_OPEN_PAREN 
TOKEN_IDENTIFIER 
TOKEN_STRING 
TOKEN_PERIOD 
TOKEN_OPEN_CURLY 
TOKEN_CLOSE_CURLY 
TOKEN_EQUAL_SIGN 
TOKEN_EXCLAMATION 
TOKEN_FORWARD_SLASH 
TOKEN_OPEN_SQUARE 
TOKEN_CLOSE_SQUARE 
TOKEN_OPEN_MXML 
TOKEN_CLOSE_MXML 
TOKEN_CLOSE_SGML 
TOKEN_LESS_THAN 
TOKEN_GREATER_THAN 
TOKEN_QUESTION_MARK 
TOKEN_OPEN_NAMESPACE 
TOKEN_POSTFIX_OPERATOR 
TOKEN_STAR 
TOKEN_BINARY_OPERATOR 
TOKEN_UNDEFINED 
TOKEN_COMMA 
TOKEN_DOUBLE_COLON 
TOKEN_IDENTIFIER 
TOKEN_KEYWORD 
TOKEN_LABEL 
TOKEN_NUMERIC 
TOKEN_OPERATOR 
TOKEN_PAREN_CLOSE 
TOKEN_PAREN_OPEN 
TOKEN_SQUARE_CLOSE 
TOKEN_SQUARE_OPEN 
TOKEN_PERCENT 
TOKEN_STATEMENT_END 
TOKEN_STRING 
TOKEN_NONE 
TOKEN_OTHER 
TOKEN_KEYWORD 
TOKEN_IDENTIFIER 
TOKEN_STRING 
TOKEN_OPEN_PAREN 
TOKEN_CLOSE_PAREN 
TOKEN_OPEN_CURLY 
TOKEN_CLOSE_CURLY 
TOKEN_OPEN_SQUARE 
TOKEN_CLOSE_SQUARE 
TOKEN_SEMICOLON 
TOKEN_STAR 
TOKEN_LEFT_ARROW 
TOKEN_DOT 
TOKEN_COMMA 
TOKEN_EOF 
TOKEN_UNDEFINED 
TOKEN_EOF 
TOKEN_CHARACTER 
TOKEN_CLOSE_PAREN 
TOKEN_SEMICOLON 
TOKEN_COLON 
TOKEN_COMMA 
TOKEN_KEYWORD 
TOKEN_OPEN_PAREN 
TOKEN_IDENTIFIER 
TOKEN_STRING 
TOKEN_TEMPLATE_STRING 
TOKEN_PERIOD 
TOKEN_OPEN_CURLY 
TOKEN_CLOSE_CURLY 
TOKEN_EQUAL_SIGN 
TOKEN_OPEN_SQUARE 
TOKEN_CLOSE_SQUARE 
TOKEN_REGEXP 
TOKEN_POSTFIX_OPERATOR 
TOKEN_STAR 
TOKEN_BINARY_OPERATOR 
TOKEN_UNDEFINED 
TOKEN_EOF 
TOKEN_CHARACTER 
TOKEN_CLOSE_PAREN 
TOKEN_SEMICOLON 
TOKEN_COLON 
TOKEN_COMMA 
TOKEN_KEYWORD 
TOKEN_OPEN_PAREN 
TOKEN_OPERATOR 
TOKEN_IDENTIFIER 
TOKEN_STRING 
TOKEN_PERIOD 
TOKEN_OPEN_CURLY 
TOKEN_CLOSE_CURLY 
TOKEN_EQUAL_SIGN 
TOKEN_OPEN_SQUARE 
TOKEN_CLOSE_SQUARE 
TOKEN_VARIABLE 
TOKEN_AMPERSAND 
TOKEN_UNDEFINED 
TOKEN_EOF 
TOKEN_CLOSE_PAREN 
TOKEN_SEMICOLON 
TOKEN_COLON 
TOKEN_COMMA 
TOKEN_KEYWORD 
TOKEN_OPEN_PAREN 
TOKEN_OPERATOR 
TOKEN_IDENTIFIER 
TOKEN_STRING 
TOKEN_PERIOD 
TOKEN_OPEN_CURLY 
TOKEN_CLOSE_CURLY 
TOKEN_EQUAL_SIGN 
TOKEN_OPEN_SQUARE 
TOKEN_CLOSE_SQUARE 
TOKEN_VARIABLE 
TOKEN_UNDEFINED 
TOKEN_BLOCK_LABEL_BEGIN 
TOKEN_BLOCK_LABEL_END 
TOKEN_CHARACTER 
TOKEN_CLOSE_PAREN 
TOKEN_COLON 
TOKEN_SEMICOLON 
TOKEN_COMMA 
TOKEN_IDENTIFIER 
TOKEN_KEYWORD 
TOKEN_OPEN_PAREN 
TOKEN_OPERATOR 
TOKEN_OTHER 
TOKEN_STRING 
TOKEN_PERIOD 
TOKEN_OPEN_CURLY 
TOKEN_CLOSE_CURLY 
TOKEN_OPEN_SQUARE 
TOKEN_CLOSE_SQUARE 
TOKEN_TILDE 
TOKEN_FORWARD_SLASH 
TOKEN_EQUAL 

Definition at line 50 of file geany_powershell.c.

◆ powerShellKind

Enumerator
K_FUNCTION 
K_VARIABLE 
COUNT_KIND 

Definition at line 38 of file geany_powershell.c.

Function Documentation

◆ addToScope()

static void addToScope ( tokenInfo *const  token,
const vString *const  extra 
)
static

Definition at line 178 of file geany_powershell.c.

References tokenInfo::scope, SCOPE_SEPARATOR, vStringCatS(), vStringLength, and vStringValue.

Referenced by enterScope().

◆ copyToken()

static void copyToken ( tokenInfo *const  dest,
const tokenInfo *const  src,
bool  scope 
)
static

◆ deleteToken()

static void deleteToken ( tokenInfo *const  token)
static

◆ enterScope()

static void enterScope ( tokenInfo *const  parentToken,
const vString *const  extraScope,
const int  parentKind 
)
static

◆ findPowerShellTags()

static void findPowerShellTags ( void  )
static

Definition at line 585 of file geany_powershell.c.

References deleteToken(), enterScope(), newToken(), NULL, TOKEN_EOF, and tokenInfo::type.

Referenced by PowerShellParser().

◆ findValidAccessType()

static const char * findValidAccessType ( const char *const  access)
static

Definition at line 81 of file geany_powershell.c.

References access, ACCESS_UNDEFINED, accessTypes, ARRAY_SIZE, and strcasecmp.

Referenced by parsePowerShellScope().

◆ initPowerShellEntry()

◆ isIdentChar()

static bool isIdentChar ( const int  c)
static

Definition at line 185 of file geany_powershell.c.

Referenced by parseIdentifier(), and readToken().

◆ isSpace()

static bool isSpace ( int  c)
static

Definition at line 222 of file geany_powershell.c.

Referenced by skipWhitespaces().

◆ isTokenFunction()

static bool isTokenFunction ( vString *const  name)
static

Definition at line 216 of file geany_powershell.c.

References name, strcasecmp, and vStringValue.

Referenced by readToken().

◆ makeFunctionTag()

static void makeFunctionTag ( const tokenInfo *const  token,
const vString *const  arglist,
const char *const  access 
)
static

◆ makeSimplePowerShellTag()

static void makeSimplePowerShellTag ( const tokenInfo *const  token,
const powerShellKind  kind,
const char *const  access 
)
static

Definition at line 117 of file geany_powershell.c.

References access, initPowerShellEntry(), makeTagEntry(), and PowerShellKinds.

Referenced by parseVariable().

◆ newToken()

◆ parseFunction()

◆ parseIdentifier()

static void parseIdentifier ( vString *const  string,
const int  firstChar 
)
static

Definition at line 205 of file geany_powershell.c.

References getcFromInputFile(), isIdentChar(), ungetcToInputFile(), and vStringPut().

Referenced by readToken().

◆ parsePowerShellScope()

static const char * parsePowerShellScope ( tokenInfo *const  token)
static

◆ parseString()

static void parseString ( vString *const  string,
const int  delimiter 
)
static

Definition at line 190 of file geany_powershell.c.

References getcFromInputFile(), and vStringPut().

Referenced by readToken().

◆ parseVariable()

◆ PowerShellParser()

◆ readToken()

◆ skipSingleComment()

static int skipSingleComment ( void  )
static

Definition at line 235 of file geany_powershell.c.

References getcFromInputFile(), and ungetcToInputFile().

Referenced by readToken().

◆ skipWhitespaces()

static int skipWhitespaces ( int  c)
static

Definition at line 228 of file geany_powershell.c.

References getcFromInputFile(), and isSpace().

Referenced by readToken().

Variable Documentation

◆ accessTypes

const char* const accessTypes[]
static
Initial value:
= {
NULL ,
"global",
"local",
"script",
"private"
}
#define NULL
Definition: rbtree.h:150

Definition at line 30 of file geany_powershell.c.

Referenced by findValidAccessType().

◆ PowerShellKinds

kindDefinition PowerShellKinds[COUNT_KIND]
static
Initial value:
= {
{ true, 'f', "function", "functions" },
{ true, 'v', "variable", "variables" }
}

Definition at line 44 of file geany_powershell.c.

Referenced by makeFunctionTag(), makeSimplePowerShellTag(), and PowerShellParser().