mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.11.1.1
This commit is contained in:
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.phps; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
/*
|
||||
NOTE: naive implementation of PHP evaluator. intended only for parsing Messages**.php files in MediaWiki. Specifically, it assumes the following:
|
||||
- all lines are assignment lines: EX: $a = b;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.phps; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.core.btries.*; import gplx.core.log_msgs.*;
|
||||
interface Php_lxr {
|
||||
int Lxr_tid();
|
||||
void Lxr_ini(Btrie_slim_mgr trie, Php_parser_interrupt[] parser_interrupts);
|
||||
@@ -117,7 +117,7 @@ class Php_lxr_comment extends Php_lxr_base {
|
||||
public byte[] Comment_end() {return comment_end;} private byte[] comment_end;
|
||||
@Override public int Lxr_make(Php_ctx ctx, int bgn, int cur) {
|
||||
int end = Bry_find_.Find_fwd(src, comment_end, bgn);
|
||||
if (end == Bry_.NotFound) {
|
||||
if (end == Bry_find_.Not_found) {
|
||||
tkn_wkr.Msg_many(src, bgn, cur, Php_lxr_comment.Dangling_comment, comment_tid, comment_end);
|
||||
cur = src_len; // NOTE: terminating sequence not found; assume rest of src is comment
|
||||
}
|
||||
@@ -198,7 +198,7 @@ class Php_lxr_quote extends Php_lxr_base {
|
||||
int end = -1;
|
||||
while (true) {
|
||||
end = Bry_find_.Find_fwd(src, quote_bry, cur);
|
||||
if (end == Bry_.NotFound) {
|
||||
if (end == Bry_find_.Not_found) {
|
||||
tkn_wkr.Msg_many(src, bgn, cur, Php_lxr_quote.Dangling_quote, quote_tid, quote_bry);
|
||||
cur = src_len; // NOTE: terminating sequence not found; assume rest of src is comment
|
||||
break;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.phps; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.core.btries.*; import gplx.core.log_msgs.*;
|
||||
public class Php_parser {
|
||||
Php_lxr[] lxrs; int lxrs_len;
|
||||
int txt_bgn; Php_tkn_txt txt_tkn;
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.phps; import gplx.*; import gplx.langs.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
import org.junit.*; import gplx.core.tests.*; import gplx.core.log_msgs.*;
|
||||
public class Php_parser_tst {
|
||||
Php_parser_fxt fxt = new Php_parser_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
|
||||
@@ -39,7 +39,7 @@ abstract class Php_srl_itm_base implements Php_srl_itm {
|
||||
@gplx.Virtual public void Xto_bfr(Bry_bfr bfr, int depth) {
|
||||
Php_srl_wtr.Indent(bfr, depth);
|
||||
bfr.Add(Php_srl_itm_.Names[this.Tid()]).Add_byte(Byte_ascii.Colon);
|
||||
bfr.Add_str(Object_.Xto_str_strict_or_null_mark(this.Val())).Add_byte(Byte_ascii.Semic).Add_byte_nl();
|
||||
bfr.Add_str_u8(Object_.Xto_str_strict_or_null_mark(this.Val())).Add_byte(Byte_ascii.Semic).Add_byte_nl();
|
||||
}
|
||||
public void Clear() {}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.phps; import gplx.*; import gplx.langs.*;
|
||||
import gplx.texts.*;
|
||||
import gplx.core.texts.*;
|
||||
public class Php_srl_parser {
|
||||
@gplx.Internal protected Php_srl_factory Factory() {return factory;} Php_srl_factory factory = new Php_srl_factory();
|
||||
byte[] raw; int raw_len, pos;
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.phps; import gplx.*; import gplx.langs.*;
|
||||
import gplx.core.log_msgs.*;
|
||||
public interface Php_tkn_wkr {
|
||||
void Init(Php_ctx ctx);
|
||||
void Process(Php_tkn tkn);
|
||||
|
||||
Reference in New Issue
Block a user