added the feature to treat comments(with single or multiple line)

Esse commit está contido em:
Felipe Nascimento de Moura
2011-01-03 02:29:57 -02:00
commit e495d95592
4 arquivos alterados com 52 adições e 7 exclusões
+14 -2
Ver Arquivo
@@ -84,10 +84,13 @@ class Lexer
*/
public function sweep($content)
{
// let's treat the single line comments
$content= preg_replace('/\/\/.+\n/', '', $content);
// now, it's time to start working with the data
$this->content= trim(str_replace("\n", ' ', $content));
$this->originalContent= $this->content;
$this->content= $this->str_split_utf8($this->content);
// untill here, it's all fine
// the fixed content;
$fixed= "";
@@ -105,9 +108,18 @@ class Lexer
{
$fixed= str_replace($char, $token, $fixed);
}
// let's deal with the \n and multiline comments
$fixed= preg_replace("/\n/", $this->tokens[' '], $fixed);
$fixed= array_filter(explode($this->tokens[' '], $fixed));
$fixed= preg_replace('/\/\*.+\*\//', '', $fixed);
$exploded= explode($this->tokens[' '], $fixed);
//$exploded= preg_split('//', $fixed);
$fixed= array_filter($exploded);
Mind::$content= $fixed;
return sizeof(Mind::$content)>0? Mind::$content: false;
}
+5 -2
Ver Arquivo
@@ -44,8 +44,11 @@ class Canonic extends Inflect{
{
if(strlen($word) > 1 && ($isVerb= Verbalizer::isVerb($word)))
$word= Verbalizer::toInfinitive($word);
else
$word= Canonic::canonize($word);
else{
$word= explode(':', $word);
$word[0]= Canonic::canonize($word[0]);
$word= implode(':', $word);
}
}
$newContent[]= $word;
}
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document : datatypes.xml
Created on : January 3, 2011, 12:04 AM
Author : felipe
Description:
This document defines the translation and
definition for data types in database
It uses the most basic forms of data to be
stored
-->
<root>
<varchar>string,characteres,varchar,descrição,desc,obs</varchar>
<char>char,caracter,letra,digito</char>
<int>int,integer,inteiro,dígito,número</int>
<float>float,real,double,dinheiro,percentagem,perc,porcentagem,precisão</float>
<boolean>bool,boolean,boleano</boolean>
<date>date,data,dia</date>
<time>time,tempo,datahora,datetime,dthr,dt</time>
<file>blob,oid,lo,file,arquivo,binario,binary</file>
</root>
+12 -3
Ver Arquivo
@@ -1,3 +1,12 @@
aluno tem nenhum ou vários professores.
aluno tem zero ou vários professores.
aluno tem 0 ou vários professores.
aluno tem professor
//professor tem piça
professor tem aluno
/*
blablabla
mimimi
xxx
blabelaebamimi
*/
aluno tem pai, mãe e papagaio.
aluno tem nome:caractere(128, obrigatório, não nulo, "josé da conceição")