Skip to content

Commit

Permalink
Dev Minor regex fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Apr 12, 2015
1 parent 7f4cd27 commit 56da5f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions application/libraries/ExpressionManager/Parser.php
Expand Up @@ -35,6 +35,7 @@ class Parser{

public function parse($string) {
// First tokenize it.
$this->error = null;
$this->tokenizer = new Tokenizer();
$tokens = $this->tokenizer->tokenize($string);
$stack = new Stack();
Expand Down Expand Up @@ -410,10 +411,10 @@ protected function parseApply(TokenStream $tokens, Stack $stack)
)
|| $tokens->rollback() || $stack->rollback()
) {
// Basically this is a unary operator.
// Basically this is a function operator.
$operator = $stack->pop();
$operand = $stack->pop();
$stack->push([$operator, $operand]);
$stack->push([$operator, [$operand]]);

}
// Always return true since this is an optional rule.
Expand Down
5 changes: 3 additions & 2 deletions application/libraries/ExpressionManager/Tokenizer.php
Expand Up @@ -14,13 +14,14 @@ class Tokenizer {
'EQ_OP' => ['<=', '<', '>=', '>', '==', '!=', '\ble\b', '\blt\b', '\bge\b', '\bgt\b', '\beq\b', '\bne\b'],
'MULTI_OP' => ['\*', '/'],
'ADD_OP' => ['\+', '\b-\b'],
'SGQA' => '[0-9]+X[0-9]+X[0-9]+[A-Z0-9_]',
'SGQA' => '[0-9]+X[0-9]+X[0-9]+[A-Z0-9_]*',
'BOOL' => ['true', 'false'],
'UN_OP' => '!',
'LOGIC_OP' => ['\band\b', '\bor\b', '&&' , '\|\|'],
'NUMBER' => ['-?[0-9]+\.?[0-9]*', '-?[0-9]*\.?[0-9]+'],
'APPLY' => ['\.'],
'WORD' => '[A-Z][A-Z0-9_]*',
'NUMBER' => '-?[0-9]+\.?[0-9]*',



];
Expand Down

0 comments on commit 56da5f3

Please sign in to comment.