Add option to disable parIdentifier
This commit is contained in:
parent
f50b87f68c
commit
68b952d105
@ -1,5 +1,7 @@
|
|||||||
#ifndef DEF_CONFIG_H
|
#ifndef DEF_CONFIG_H
|
||||||
#define DEF_CONFIG_H
|
#define DEF_CONFIG_H
|
||||||
|
|
||||||
|
// Parse identifiers wrapped in parentheses
|
||||||
|
//#define PAR_IDENTIFIER
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -6,6 +6,7 @@ using namespace std;
|
|||||||
#include "include/tokenize.h"
|
#include "include/tokenize.h"
|
||||||
#include "include/colors.h"
|
#include "include/colors.h"
|
||||||
#include "include/parser.h"
|
#include "include/parser.h"
|
||||||
|
#include "include/config.h"
|
||||||
#include "include/utils.h"
|
#include "include/utils.h"
|
||||||
|
|
||||||
CodePosition null_pos = {
|
CodePosition null_pos = {
|
||||||
@ -997,20 +998,24 @@ ParseReturn parse_par_identifier(vector<Token> tokens) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tokens.back().type != TokenType::LParenthese)
|
#ifndef PAR_IDENTIFIER
|
||||||
throw ParseException();
|
throw ParseException();
|
||||||
|
#else
|
||||||
|
if (tokens.back().type != TokenType::LParenthese)
|
||||||
|
throw ParseException();
|
||||||
|
|
||||||
tokens.pop_back();
|
tokens.pop_back();
|
||||||
ParseReturn ret = parse_par_identifier(tokens);
|
ParseReturn ret = parse_par_identifier(tokens);
|
||||||
tokens = ret.tokens;
|
tokens = ret.tokens;
|
||||||
|
|
||||||
if (tokens.back().type != TokenType::RParenthese)
|
if (tokens.back().type != TokenType::RParenthese)
|
||||||
throw ParseException();
|
throw ParseException();
|
||||||
|
|
||||||
tokens.pop_back();
|
tokens.pop_back();
|
||||||
|
|
||||||
return { //* ParIdentifier -> (ParIdentifier)
|
return { //* ParIdentifier -> (ParIdentifier)
|
||||||
.node=ret.node,
|
.node=ret.node,
|
||||||
.tokens=tokens
|
.tokens=tokens
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user