You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
enscript/SOURCES/enscript-php-1.6.4.st

194 lines
34 KiB

/**
* Name: php
* Description: PHP programming language.
*
* Author: Daniel Frederiksen, cyberdoc@cyberdoc.dk
* Extenden functions definition including all PHP functions.
*
* Based on the initial file by
* Ian Berry, iberry@raxnet.net.
* http://home.raxnet.net/article_viewcvs_php.php
*/
state php_comment
{
/\*\\\// {
language_print ($0);
return;
}
LANGUAGE_SPECIALS {
language_print ($0);
}
}
state php_dquot_string
{
/\\\\./ {
language_print ($0);
}
/\"/ {
language_print ($0);
return;
}
LANGUAGE_SPECIALS {
language_print ($0);
}
}
state php_quot_string
{
/\\\\./ {
language_print ($0);
}
/[\']/ {
language_print ($0);
return;
}
LANGUAGE_SPECIALS {
language_print ($0);
}
}
state php_bquot_string
{
/\\\\./ {
language_print ($0);
}
/`/ {
language_print ($0);
return;
}
LANGUAGE_SPECIALS {
language_print ($0);
}
}
state php
{
BEGIN {
header ();
}
END {
trailer ();
}
/* Comments. */
/\/\*/ {
comment_face (true);
language_print ($0);
call (php_comment);
comment_face (false);
}
/\/\// {
comment_face (true);
language_print ($0);
call (eat_one_line);
comment_face (false);
}
/* Ignore escaped quote marks */
/\\\"/ {
language_print ($0);
}
/\\\'/ {
language_print ($0);
}
/\\\`/ {
language_print ($0);
}
/* stuff after a -> is a method,
* don't bold just because it looks like a keyword
*/
/->\w+/ {
language_print ($0);
}
/* stuff between a - and a => is a named parameter,
* don't bold just because it looks like a keyword
*/
/-\w+=>/ {
language_print ($0);
}
/* Ignore embedded comments */
/\/\// {
language_print ($0);
call (eat_one_line);
}
/* Control flow */
/(<\?|\?>)/ {
reference_face (true);
language_print ($0);
reference_face (false);
}
/* Code control (){} */
/[\{\}\(\)\[\]]/ {
reference_face (true);
language_print ($0);
reference_face (false);
}
/* Numerics & Logics */
/[\\-+*\/%!`]/ {
function_name_face (true);
language_print ($0);
function_name_face (false);
}
/* String constants. */
/\"/ {
string_face (true);
language_print ($0);
call (php_dquot_string);
string_face (false);
}
/[\']/ {
string_face (true);
language_print ($0);
call (php_quot_string);
string_face (false);
}
/* Backquoted command string */
/`/ {
string_face (true);
language_print ($0);
call (php_bquot_string);
string_face (false);
}
/* Variables */
/(\$+[a-zA-Z0-9_-]*)/ {
variable_name_face (true);
language_print ($1);
variable_name_face (false);
}
/* Functions (All PHP function 2004-09-19) */
/\b(a(cosh?|ddc?slashes|ggregat(e(_(methods(_by_(list|regexp))?|properties(_by_(list|regexp))?|info))?|ion_info)|pache_(get(_(modules|version)|env)|re(quest|sponse)_headers|(child_termina|no)te|lookup_uri|setenv)|r(ray(_(c(h(ange_key_case|unk)|o(mbine|unt_values))|diff(_(u(assoc|key)|assoc|key))?|f(il(l|ter)|lip)|intersect(_(u(assoc|key)|assoc|key))?|key(_exist)?s|m(erge(_recursive)?|ap|ultisort)|p(ad|op|ush)|r(e(duc|vers)e|and)|s(earch|hift|p?lice|um)|u(diff(_u?assoc)?|intersect(_u?assoc)?|n(ique|shift))|walk(_recursive)?|values)|iterator_((curren|nex)t|key|(rewin|vali)d|seek)|object_(co(nstruc|un)t|offset(exists|(g|(un)?s)et)|append|getiterator))?|sort)|s(inh?|pell_(check(_raw)?|new|suggest)|sert(_options)?|cii2ebcdic|ort)|tan[2h]?|bs)|b(ase(64_(de|en)code|_convert|name)|c(m(od|ul)|pow(mod)?|s(cale|qrt|ub)|add|comp|div)|in(d(_textdomain_codeset|ec|textdomain)|2hex)|z(c(lose|ompress)|err(no|(o|st)r)|decompress|flush|open|read|write))|c(a(ching(iterator_((has)?next|(rewin|vali)d|tostring)|recursiveiterator_(get|has)children)|l(_(days_in_month|(from|to)_jd|info)|l_user_(func(_array)?|method(_array)?)))|cvs_(a(dd|uth)|co(mmand|unt)|d(elet|on)e|re(port|turn|verse)|s(ale|tatus)|init|lookup|new|textvalue|void)|h(eckd(ate|nsrr)|o(p|wn)|r(oot)?|dir|grp|mod|unk_split)|l(ass(kit_method_(re(defin|mov|nam)e|add|copy)|_exists)|ose(dir|log)|earstatcache)|o(m(_(get(_active_object)?|i(nvoke|senum)|load(_typelib)?|pr(op([gs]e|pu)t|int_typeinfo)|addref|create_guid|event_sink|message_pump|release|set)|pact)?|n(nection_(aborted|status|timeout)|vert_(uu(de|en)code|cyr_string)|stant)|sh?|unt(_chars)?|py)|pdf_(a(dd_(annotation|outline)|rc)|c(l(ose(path(_(fill_)?stroke)?)?|ip)|ircle|ontinue_text|urveto)|fi(ll(_stroke)?|nalize(_page)?)|o(pen|utput_buffer)|p(age_init|lace_inline_image)|r(e(ct|store)|otate(_text)?|(lin|mov)eto)|s(ave(_to_file)?|et(_(c(har_spacing|reator|urrent_page)|font(_(directories|map_file))?|t(ext_(r(endering|ise)|matrix|pos)|itle)|action_url|(horiz_scal|lead|word_spac)ing|(keyword|viewer_preference)s|page_animation|subject)|gray(_(fill|stroke))?|line(cap|join|width)|rgbcolor(_(fill|stroke))?|dash|(fla|miterlimi)t)|how(_xy)?|tr(ingwidth|oke)|cale)|t(ext|ranslate)|(begin|end)_text|global_set_document_limits|import_jpeg|(lin|mov)eto|newpath)|r(ack_(c(heck|losedict)|getlastmessage|opendict)|c32|eate_function|ypt)|type_(al(num|pha)|p(rin|unc)t|cntrl|x?digit|graph|(low|upp)er|space)|ur(l_(c(los|opy_handl)e|e(rr(no|or)|xec)|multi_(in(fo_read|it)|((add|remove)_handl|clos)e|exec|(getconten|selec)t)|getinfo|(ini|setop)t|version)|rent)|y(bercash_(base64_(de|en)code|(de|en)cr)|rus_(c(lose|onnect)|authenticate|(un)?bind|query))|eil)|d(b(a(_(f(etch|irstkey)|op(en|timize)|(clos|delet|replac)e|(exist|handler)s|(inser|key_spli|lis)t|nextkey|popen|sync)|se_(c(los|reat)e|get_(record(_with_names)?|header_info)|num(fiel|recor)ds|(add|(delet|replac)e)_record|open|pack))|m(f(etch|irstkey)|(clos|delet|replac)e|exists|insert|nextkey|open)|plus_(a(dd|ql)|c((hdi|ur)r|lose)|err(code|no)|f(i(nd|rst)|ree((all|r)locks|lock)|lush)|get(lock|unique)|l(ast|ockrel)|r(c(r(t(exact|like)|eate)|hperm)|es(olve|torepos)|keys|open|query|rename|secindex|unlink|zap)|s(etindex(bynumber)?|avepos|ql)|t(cl|remove)|u(n(do(prepare)?|lockrel|select)|pdate)|x(un)?lockrel|info|next|open|prev)|x_(c(o(mpare|nnect)|lose)|e(rror|scape_string)|fetch_row|query|sort)|list)|cn?gettext|e(bug(_(print_)?backtrace|ger_o(ff|n))|c(bin|hex|oct)|fine(_syslog_variables|d)?|(aggrega|le)te|g2rad)|i(o_(s(eek|tat)|t(csetattr|runcate)|(clos|writ)e|fcntl|open|read)|r(ectoryiterator_(c(onstruc|urren)t|file(([acm]tim|inod|siz|typ)e|group|owner|perms)|get(path(name)?|children|filename)|is(d(ir|ot)|(((execu|wri)t|read)ab|fi)le|link)|key|next|(rewin|vali)d)|name)?|sk(_(free|total)_space|freespace)|e)|n(s_(get_(mx|record)|check_record)|gettext)|o(m(_(dom(characterdata_(append|(delet|replac)e|insert|substring)data|document_(create(attribute(ns)?|c(datasection|omment)|e(lement(ns)?|ntityreference)|documentfragment|processinginstruction|textnode)|getelement(sbytagname(ns)?|byid)|load(html(file)?|xml)?|rel
function_name_face (true);
language_print ($0);
function_name_face (false);
}
/\b(include|if|elseif|include_once|require|require_once|while|for|function|
return|case|default|global|switch|else|break|return|as|foreach|var|const|class|__construct|__deconstruct)\b/ {
keyword_face (true);
language_print ($0);
keyword_face (false);
}
LANGUAGE_SPECIALS {
language_print ($0);
}
}