Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Split the core #48

Merged
merged 7 commits into from
Jan 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Bin/Pp.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -37,6 +37,7 @@
namespace Hoa\Compiler\Bin;

use Hoa\Compiler;
use Hoa\Consistency;
use Hoa\Console;
use Hoa\File;

Expand All @@ -45,7 +46,7 @@
*
* Play with PP.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Pp extends Console\Dispatcher\Kit
Expand Down Expand Up @@ -152,7 +153,7 @@ public function main()
}

if (null !== $visitor) {
$visitor = dnew($visitor);
$visitor = Consistency\Autoloader::dnew($visitor);
echo $visitor->visit($ast);
}

Expand Down
13 changes: 7 additions & 6 deletions Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -36,21 +36,22 @@

namespace Hoa\Compiler\Exception;

use Hoa\Core;
use Hoa\Consistency;
use Hoa\Exception as HoaException;

/**
* Class \Hoa\Compiler\Exception.
*
* Extending the \Hoa\Core\Exception class.
* Extending the \Hoa\Exception\Exception class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Exception extends Core\Exception
class Exception extends HoaException
{
}

/**
* Flex entity.
*/
Core\Consistency::flexEntity('Hoa\Compiler\Exception\Exception');
Consistency::flexEntity('Hoa\Compiler\Exception\Exception');
4 changes: 2 additions & 2 deletions Exception/FinalStateHasNotBeenReached.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* Extending the \Hoa\Compiler\Exception class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class FinalStateHasNotBeenReached extends Exception
Expand Down
4 changes: 2 additions & 2 deletions Exception/IllegalToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* Extending the \Hoa\Compiler\Exception class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class IllegalToken extends Exception
Expand Down
4 changes: 2 additions & 2 deletions Exception/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* Extending the \Hoa\Compiler\Exception class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Lexer extends Exception
Expand Down
4 changes: 2 additions & 2 deletions Exception/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* Extending the \Hoa\Compiler\Exception class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Rule extends Exception
Expand Down
4 changes: 2 additions & 2 deletions Exception/UnexpectedToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* Extending the \Hoa\Compiler\Exception\UnrecognizedToken class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class UnexpectedToken extends UnrecognizedToken
Expand Down
4 changes: 2 additions & 2 deletions Exception/UnrecognizedToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* Extending the \Hoa\Compiler\Exception class.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class UnrecognizedToken extends Exception
Expand Down
36 changes: 18 additions & 18 deletions Ll1.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -39,15 +39,15 @@
/**
* Define the __ constant, so useful in compiler :-).
*/
_define('GO', 'GO');
_define('__', '__');
!defined('GO') and define('GO', 'GO');
!defined('__') and define('__', '__');

/**
* Class \Hoa\Compiler\Ll1.
*
* Provide an abstract LL(1) compiler, based on sub-automata and stacks.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
abstract class Ll1
Expand Down Expand Up @@ -333,13 +333,13 @@ abstract class Ll1
* @return void
*/
public function __construct(
Array $skip,
Array $tokens,
Array $states,
Array $terminal,
Array $transitions,
Array $actions,
Array $names = []
array $skip,
array $tokens,
array $states,
array $terminal,
array $transitions,
array $actions,
array $names = []
) {
$this->setSkip($skip);
$this->setTokens($tokens);
Expand Down Expand Up @@ -708,7 +708,7 @@ public function setInitialLine($line)
* @param array $skip Skip.
* @return array
*/
public function setSkip(Array $skip)
public function setSkip(array $skip)
{
$old = $this->_skip;
$this->_skip = $skip;
Expand All @@ -723,7 +723,7 @@ public function setSkip(Array $skip)
* @param array $tokens Tokens.
* @return array
*/
public function setTokens(Array $tokens)
public function setTokens(array $tokens)
{
$old = $this->_tokens;
$this->_tokens = $tokens;
Expand All @@ -737,7 +737,7 @@ public function setTokens(Array $tokens)
* @param array $states States.
* @return array
*/
public function setStates(Array $states)
public function setStates(array $states)
{
$old = $this->_states;
$this->_states = $states;
Expand All @@ -751,7 +751,7 @@ public function setStates(Array $states)
* @param array $terminal Terminal states.
* @return array
*/
public function setTerminal(Array $terminal)
public function setTerminal(array $terminal)
{
$old = $this->_terminal;
$this->_terminal = $terminal;
Expand All @@ -765,7 +765,7 @@ public function setTerminal(Array $terminal)
* @param array $transitions Transitions table.
* @return array
*/
public function setTransitions(Array $transitions)
public function setTransitions(array $transitions)
{
$old = $this->_transitions;
$this->_transitions = $transitions;
Expand All @@ -779,7 +779,7 @@ public function setTransitions(Array $transitions)
* @param array $actions Actions table.
* @return array
*/
public function setActions(Array $actions)
public function setActions(array $actions)
{
foreach ($actions as $e => $automata) {
foreach ($automata as $i => $state) {
Expand All @@ -803,7 +803,7 @@ public function setActions(Array $actions)
* @param array $names Names of automata.
* @return array
*/
public function setNames(Array $names)
public function setNames(array $names)
{
$old = $this->_names;
$this->_names = $names;
Expand Down
6 changes: 3 additions & 3 deletions Llk/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -43,7 +43,7 @@
*
* PP lexer.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Lexer
Expand Down Expand Up @@ -87,7 +87,7 @@ class Lexer
* @return array
* @throws \Hoa\Compiler\Exception\UnrecognizedToken
*/
public function lexMe($text, Array $tokens)
public function lexMe($text, array $tokens)
{
$this->_text = $text;
$this->_tokens = $tokens;
Expand Down
8 changes: 4 additions & 4 deletions Llk/Llk.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -37,7 +37,7 @@
namespace Hoa\Compiler\Llk;

use Hoa\Compiler;
use Hoa\Core;
use Hoa\Consistency;
use Hoa\Stream;

/**
Expand All @@ -50,7 +50,7 @@
* skipped token (::token::), kept token (<token>), token unification (token[i])
* and rule unification (rule()[j]).
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Llk
Expand Down Expand Up @@ -250,4 +250,4 @@ public static function parsePP($pp, &$tokens, &$rules, $streamName)
/**
* Flex entity.
*/
Core\Consistency::flexEntity('Hoa\Compiler\Llk\Llk');
Consistency::flexEntity('Hoa\Compiler\Llk\Llk');
6 changes: 3 additions & 3 deletions Llk/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
* Copyright © 2007-2016, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -43,7 +43,7 @@
*
* PP parser.
*
* @copyright Copyright © 2007-2015 Hoa community
* @copyright Copyright © 2007-2016 Hoa community
* @license New BSD License
*/
class Parser
Expand Down Expand Up @@ -128,7 +128,7 @@ class Parser
* @param array $rules Rules.
* @return void
*/
public function __construct(Array $tokens = [], Array $rules = [])
public function __construct(array $tokens = [], array $rules = [])
{
$this->_tokens = $tokens;
$this->_rules = $rules;
Expand Down
Loading