mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 11:39:58 +02:00
[poincare] Add YYSTYPE declaration in the lexer
This commit is contained in:
@@ -5,6 +5,9 @@ SFLAGS += -Ipoincare/include
|
||||
objs += $(addprefix poincare/src/,\
|
||||
addition.o\
|
||||
arithmetic.o\
|
||||
expression_lexer.o\
|
||||
expression_parser.o\
|
||||
layout_helper.o\
|
||||
matrix_complex.o\
|
||||
multiplication.o\
|
||||
power.o\
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include <ion.h>
|
||||
#include <cmath>
|
||||
#include <float.h>
|
||||
//#include "expression_parser.hpp"
|
||||
//#include "expression_lexer.hpp"
|
||||
#include "expression_parser.hpp"
|
||||
#include "expression_lexer.hpp"
|
||||
|
||||
int poincare_expression_yyparse(Poincare::Expression * expressionOutput);
|
||||
|
||||
|
||||
@@ -40,6 +40,19 @@
|
||||
* requires feature. */
|
||||
#include <cmath>
|
||||
#include <poincare.h>
|
||||
|
||||
struct OurNodeValue{
|
||||
Poincare::Expression expression;
|
||||
Poincare::Symbol symbol;
|
||||
struct {
|
||||
char * address;
|
||||
int length;
|
||||
} string;
|
||||
char character;
|
||||
};
|
||||
#define YYSTYPE OurNodeValue
|
||||
|
||||
|
||||
#include "expression_parser.hpp"
|
||||
using namespace Poincare;
|
||||
|
||||
|
||||
@@ -8,15 +8,23 @@
|
||||
%{
|
||||
#include <poincare.h>
|
||||
|
||||
struct YYSTYPE {
|
||||
Poincare::Expression expression;
|
||||
Poincare::Symbol symbol;
|
||||
struct {
|
||||
char * address;
|
||||
int length;
|
||||
} string;
|
||||
char character;
|
||||
/* TODO Comment
|
||||
Usually, YYSTYPE is defined as the union of the objects it might be. Here, these objects are non-trivial, as some have comple constructors and destructors
|
||||
struct et pas union car constructeurs/compliqués donc si union on ne sait pas comment appeler
|
||||
on a besoin de mettre la meme chose dans le lexer car on arrive pas à mettre la struc dans expression_parser.hpp qui est inclus dans expression_lexer normalement pour ça
|
||||
|
||||
|
||||
*/
|
||||
struct OurNodeValue{
|
||||
Poincare::Expression expression;
|
||||
Poincare::Symbol symbol;
|
||||
struct {
|
||||
char * address;
|
||||
int length;
|
||||
} string;
|
||||
char character;
|
||||
};
|
||||
#define YYSTYPE OurNodeValue
|
||||
|
||||
|
||||
/* The lexer manipulates tokens defined by the parser, so we need the following
|
||||
|
||||
Reference in New Issue
Block a user