I noticed that this module is very similar to https://github.com/GiorgosK/simple_lexer_parser

Is there a reason to post this on drupal.org? If so, it should be clearly documented on the project page and ideally credit should be given to https://github.com/GiorgosK/simple_lexer_parser as the origin of the code.

What's the plan for merging fixes here back on github? That would also be good to clarify on the project page.

If there's not really a good reason to have this in both places perhaps this project should be deleted.

Comments

greggles created an issue. See original summary.

vuil’s picture

The project / module can be used to auto-calculation mathematical field/s where is need. I think that would be useful for everybody with similar needs. Thank you for the question.

greggles’s picture

What is the benefit of having it on drupal.org as opposed to just leaving it on github?

Usually when a project is mirrored between the 2 sites there is an explicit reason for mirroring it. Otherwise it should be left in the original place desired by the original author.

vuil’s picture

The module is on Drupal.org (here) only.

greggles’s picture

You still didn't answer the question of what you hope to achieve by moving it here.

Did you discuss having it on drupal.org only with the original author, GiorgosK?

For what it's worth, I did a diff of the src subsdirectories of the first commit here and the last commit on github and it's basically code style kind of changes.

diff -r simple_lexer_parser/src/ math_field/src/
diff -r simple_lexer_parser/src/Calculator.php math_field/src/Calculator.php
3c3
< namespace Drupal\simple_lexer_parser;
---
> namespace Drupal\math_field;
8c8
<  * @package Drupal\simple_lexer_parser
---
>  * @package Drupal\math_field
13c13
<    * Lexical analysis on a given arithmetic expression
---
>    * Lexical analysis on a given arithmetic expression.
16c16
<    *   an arithmetic expression in infix notation
---
>    *   An arithmetic expression in infix notation.
19c19
<    *   The result of the expression in postfix notation
---
>    *   The result of the expression in postfix notation.
22,27c22,26
<    *   on following occasions
<    *   Empty expression
<    *   Invalid character
<    *   Mismatched parentheses
<    *   Unexpected token
<    *
---
>    *   On following occasions,
>    *   Empty expression,
>    *   Invalid character,
>    *   Mismatched parentheses,
>    *   Unexpected token.
29c28
<   function lexer($expression) {
---
>   public static function lexer($expression) {
35,36c34
<
<     $precedence = array(
---
>     $precedence = [
41c39
<     );
---
>     ];
46c44,45
<     // for the purpose of comparing only; it's forced to top priority explicitly
---
>     // For the purpose of comparing only.
>     // It is forced to top priority explicitly.
50,52c49,51
<     // tokenizer
<     $tokens = array();
<     for ($i = 0;isset($expression[$i]); $i++) {
---
>     // Tokenizer.
>     $tokens = [];
>     for ($i = 0; isset($expression[$i]); $i++) {
55,56c54,56
<         // noop, whitespace
<       } elseif (strstr($simpletokens, $chr)) {
---
>         // Nothing, whitespace.
>       }
>       elseif (strstr($simpletokens, $chr)) {
58c58,59
<       } elseif (strstr($numbers, $chr)) {
---
>       }
>       elseif (strstr($numbers, $chr)) {
64c65,66
<       } else {
---
>       }
>       else {
70,72c72,74
<     //simple shunting yard algorithm
<     $output_queue = array();
<     $op_stack = array();
---
>     // Shunting-yard algorithm.
>     $output_queue = [];
>     $op_stack = [];
77c79,80
<       } elseif (strstr($operators, $token)) {
---
>       }
>       elseif (strstr($operators, $token)) {
82c85,86
<       } elseif ($token === '(') {
---
>       }
>       elseif ($token === '(') {
84c88,89
<       } elseif ($token === ')') {
---
>       }
>       elseif ($token === ')') {
93c98,99
<       } else {
---
>       }
>       else {
107,109c113
<     if (isset($output_queue)) {
<       return implode(' ', $output_queue);
<     }
---
>     return implode(' ', $output_queue);
113c117
<    * Evaluate an expression given in Postfix (Reverse Polish Notation)
---
>    * Evaluate an expression given in Postfix (Reverse Polish Notation).
116c120
<    *   the expression in postifx notation
---
>    *   The expression in postfix notation.
119c123,124
<    *   The result of the expression
---
>    *   The result of the expression.
>    *
121c126
<    *   When the unknown operator is found
---
>    *   When the unknown operator is found.
124c129
<     $stack = array();
---
>     $stack = [];
127d131
<
129,130d132
<       $tokenNum = "";
<
133c135,136
<       } else {
---
>       }
>       else {
139c142,143
<         } else if ($token[$i] == "/") {
---
>         }
>         elseif ($token[$i] == "/") {
141c145,146
<         } else if ($token[$i] == "-") {
---
>         }
>         elseif ($token[$i] == "-") {
143c148,149
<         } else if ($token[$i] == "+") {
---
>         }
>         elseif ($token[$i] == "+") {
145c151,152
<         } else {
---
>         }
>         else {
152a160
>
Only in math_field/src/Plugin/Field/FieldFormatter: MathFieldFormatter.php
Only in simple_lexer_parser/src/Plugin/Field/FieldFormatter: SimpleLexerParserFormatter.php
vuil’s picture

Yes, the original author know about this module.

I want to show how can be extended a Drupal functionality and to add a separate field which value can be simple computed mathematical operations. I was planning to extend (to add) more mathematical operations.

If it is problem to be here you can ask to be removed from either Drupal.org and Git repository.

vuil’s picture

Status: Active » Closed (works as designed)

I close the issue as "Closed (works as designed)". Please feel free to re-open it if someone need. Thank you!

greggles’s picture

In comment #6 you say:

Yes, the original author know about this module.

I want to show how can be extended a Drupal functionality and to add a separate field which value can be simple computed mathematical operations. I was planning to extend (to add) more mathematical operations.

If it is problem to be here you can ask to be removed from either Drupal.org and Git repository.

But in https://github.com/GiorgosK/simple_lexer_parser/issues/1 the original maintainer has said:

I became aware of this module a few days ago but I am not part of any further development (what is done on drupal.org)

That to me is just another sign of you taking actions that are not made with the best intentions and then, the most polite way say this, making mis-statements about your actions. I've given you the benefit of the doubt in this issue and you have not earned it.

vuil’s picture

Yes, I talked about the module with @GeorgiosK before. That was the reason his name to be on the main project/module page. That was his own suggestion and recommendation. Then I added his name there - please check the Project page revisions.

giorgosk’s picture

Just to get the record straight I was only made aware about this module from a friend of mine who send me a message saying that this module looks very similar to my github project.

I had to reach to @ilchovuchkov and ask for some credit and this was on 24th September as can be seen from the change log on project page https://www.drupal.org/node/3077260/revisions/11574487/view

vuil’s picture

Status: Closed (works as designed) » Fixed

@GiorgosK You are welcome! I added you as a maintainer and change the status of the issue to Fixed.

Also, thank you for the help of @greggles!

vuil’s picture

@greggles I have found something about your issue / question here:

(1.)

Hosting code at Drupal.org
Contributors are strongly encouraged to host at drupal.org rather than elsewhere (GitHub, BitBucket, your personal site, etc.). Each drupal.org project (a contributed theme, module, feature installation profile or translation) needs to be maintained in the contributions repository. If you are not using the Drupal.org infrastructure, you cannot setup a project page on Drupal.org nor can you offer your module for download at Drupal.org. Please note that all code which is committed into a Drupal repository must be covered under the terms of the GNU General Public License, version 2 or greater; the same as Drupal itself.

Source, Oct 9th 2019: https://www.drupal.org/node/7765

(2.)
Why host your project on Drupal.org: https://www.drupal.org/node/648898

I hope that the issue can be closed (for sure) as Fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

vuil’s picture