-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move keyword detection code to separate file
darcs-hash:20070422095026-ac50b-77a840e2830370f46b7a48fd8863095d2cd7a5f0.gz
- Loading branch information
1 parent
e9790db
commit 45412f2
Showing
12 changed files
with
162 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** \file parser_keywords.c | ||
*/ | ||
|
||
#include "config.h" | ||
|
||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
#include "fallback.h" | ||
//#include "util.h" | ||
|
||
//#include "wutil.h" | ||
#include "common.h" | ||
#include "parser_keywords.h" | ||
|
||
|
||
int parser_keywords_is_switch( const wchar_t *cmd ) | ||
{ | ||
if( wcscmp( cmd, L"--" ) == 0 ) | ||
return ARG_SKIP; | ||
else | ||
return cmd[0] == L'-'; | ||
} | ||
|
||
int parser_keywords_skip_arguments( const wchar_t *cmd ) | ||
{ | ||
return CONTAINS( cmd, | ||
L"else", | ||
L"begin" ); | ||
} | ||
|
||
|
||
int parser_keywords_is_subcommand( const wchar_t *cmd ) | ||
{ | ||
|
||
return parser_keywords_skip_arguments( cmd ) || | ||
CONTAINS( cmd, | ||
L"command", | ||
L"builtin", | ||
L"while", | ||
L"exec", | ||
L"if", | ||
L"and", | ||
L"or", | ||
L"not" ); | ||
|
||
} | ||
|
||
int parser_keywords_is_block( const wchar_t *word) | ||
{ | ||
return CONTAINS( word, | ||
L"for", | ||
L"while", | ||
L"if", | ||
L"function", | ||
L"switch", | ||
L"begin" ); | ||
} | ||
|
||
int parser_keywords_is_reserved( const wchar_t *word) | ||
{ | ||
return parser_keywords_is_block(word) || | ||
parser_keywords_is_subcommand( word ) || | ||
CONTAINS( word, | ||
L"end", | ||
L"case", | ||
L"else", | ||
L"return", | ||
L"continue", | ||
L"break" ); | ||
} | ||
|
Oops, something went wrong.