grammar even_numbers;
NUMBER : '0'..'9';
EVEN_NUMBER : '2' | '4' | '6' | '8';
signedEvenNumber : ('+' | '-' | ) NUMBER? EVEN_NUMBER;
错误是:
错误(208):: 4:1:永远不能匹配以下令牌定义,因为之前的令牌匹配相同的输入:EVEN_NUMBER
答案 0 :(得分:2)
如果您仔细阅读,则错误非常明确:public function invoice() {
# Simple PHP client for PDFX (http://pdfx.cs.man.ac.uk)
# Author: Alex Constantin (aconstantin@cs.man.ac.uk)
# LOCAL FILE
$file_path = 'E:\xampp\htdocs\wft\uploads\4_Sat_Sep_10_2016_16_18_52.pdf';
if(is_file($file_path)){
echo 'file exists';
}
else{
echo 'not exist';
}
if(is_readable($file_path)){
echo 'readable';
}
else{
echo 'not readable';
}
//die;
$size = filesize($file_path);
$save_path = $file_path;
# REMOTE FILE
// $file_path = 'http://pdfx.cs.man.ac.uk/example.pdf';
// $file_header = array_change_key_case(get_headers($file_path, TRUE));
// $size = $file_header['content-length'];
// $dir = getcwd()."/uploads/xml/"; # make sure this directory exists
// $save_path = $dir.basename($file_path);
$url= base_url().'uploads\4_Sat_Sep_10_2016_16_18_52.pdf';
$pdf = fopen($file_path, 'r');
$header = array('Content-Type: application/pdf', "Content-length: " . $size);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_INFILE, $pdf);
curl_setopt($ch, CURLOPT_INFILESIZE, $size);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$fp = fopen($save_path . 'x.xml', "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
if (! $res = curl_exec($ch))
echo "Error: ".curl_error($ch);
else {
echo "Success";
}
curl_close($ch);
无法匹配,因为EVEN_NUMBER
将匹配NUMBER
也匹配的内容。 EVEN_NUMBER
获得优先权,因为它是在NUMBER
之前定义的。
你可以做的是:
EVEN_NUMBER