freebsd-dev/contrib/gperf/tests/jscript.gperf
2000-03-25 07:45:29 +00:00

74 lines
1.3 KiB
Plaintext

%{
/* Command-line: gperf -k'1,2,$' -t -p -K 'name' -H 'js_kw_hash' -N 'js_kw_lookup' -a -g jscript.gperf */
%}
struct js_keyword {
char * name;
int token;
}
%%
# Javascript reserved words, see "keywords.html"
abstract, TK_ABSTRACT
boolean, TK_BOOLEAN
break, TK_BREAK
byte, TK_BYTE
case, TK_CASE
catch, TK_CATCH
char, TK_CHAR
class, TK_CLASS
const, TK_CONST
continue, TK_CONTINUE
default, TK_DEFAULT
do, TK_DO
double, TK_DOUBLE
else, TK_ELSE
extends, TK_EXTENDS
false, TK_FALSE
final, TK_FINAL
finally, TK_FINALLY
float, TK_FLOAT
for, TK_FOR
function, TK_FUNCTION
goto, TK_GOTO
if, TK_IF
implements, TK_IMPLEMENTS
import, TK_IMPORT
in, TK_IN
instanceof, TK_INSTANCEOF
int, TK_INT
interface, TK_INTERFACE
long, TK_LONG
native, TK_NATIVE
new, TK_NEW
null, TK_NULL
package, TK_PACKAGE
private, TK_PRIVATE
protected, TK_PROTECTED
public, TK_PUBLIC
return, TK_RETURN
short, TK_SHORT
static, TK_STATIC
super, TK_SUPER
switch, TK_SWITCH
synchronized, TK_SYNCHRONIZED
this, TK_THIS
throw, TK_THROW
throws, TK_THROWS
transient, TK_TRANSIENT
true, TK_TRUE
try, TK_TRY
var, TK_VAR
void, TK_VOID
while, TK_WHILE
with, TK_WITH
%%
int js_keyword_lookup (register const char *str, register int len)
{
struct js_keyword * keyword = js_kw_lookup(str,len);
if (keyword)
return keyword->token;
else
return TK_IDENT;
}