Commit c478dbf6 authored by Daniel Claudino's avatar Daniel Claudino
Browse files

Fix for observables to work with coefficients in scientific notation


Signed-off-by: default avatarDaniel Claudino <6d3@ornl.gov>
parent 6703c3ea
......@@ -14,7 +14,7 @@ carat : '^';
coeff : complex | real;
complex : '('(real | INT)','(real | INT)')';
complex : '('(real | INT | scientific)','(real | INT | scientific)')';
real : REAL;
......@@ -25,6 +25,9 @@ COMMENT : '#' ~[\r\n] * EOL;
/* Real number */
REAL : ('-') ? INT ? '.' INT;
/* scientific notation */
scientific : REAL ? ('e'|'E') ? INT;
/* Non-negative integer */
INT : ('-') ? ('0'..'9') + ;
......
#!/bin/bash
set - o errexit
java -jar antlr-4.7.2-complete.jar -Dlanguage=Cpp -listener -o generated/ -package fermion FermionOperator.g4
java -jar antlr-4.8-complete.jar -Dlanguage=Cpp -listener -o generated/ -package fermion FermionOperator.g4
......@@ -6,6 +6,8 @@ null
'('
','
')'
'e'
'E'
null
null
null
......@@ -20,6 +22,8 @@ null
null
null
null
null
null
COMMENT
REAL
INT
......@@ -37,7 +41,8 @@ coeff
complex
real
comment
scientific
atn:
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 13, 71, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 27, 10, 2, 12, 2, 14, 2, 30, 11, 2, 3, 3, 3, 3, 3, 4, 5, 4, 35, 10, 4, 3, 4, 7, 4, 38, 10, 4, 12, 4, 14, 4, 41, 11, 4, 3, 5, 3, 5, 3, 6, 3, 6, 5, 6, 47, 10, 6, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, 53, 10, 8, 3, 9, 3, 9, 3, 9, 5, 9, 58, 10, 9, 3, 9, 3, 9, 3, 9, 5, 9, 63, 10, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 2, 2, 12, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 2, 3, 3, 2, 3, 4, 2, 67, 2, 22, 3, 2, 2, 2, 4, 31, 3, 2, 2, 2, 6, 34, 3, 2, 2, 2, 8, 42, 3, 2, 2, 2, 10, 44, 3, 2, 2, 2, 12, 48, 3, 2, 2, 2, 14, 52, 3, 2, 2, 2, 16, 54, 3, 2, 2, 2, 18, 66, 3, 2, 2, 2, 20, 68, 3, 2, 2, 2, 22, 28, 5, 6, 4, 2, 23, 24, 5, 4, 3, 2, 24, 25, 5, 6, 4, 2, 25, 27, 3, 2, 2, 2, 26, 23, 3, 2, 2, 2, 27, 30, 3, 2, 2, 2, 28, 26, 3, 2, 2, 2, 28, 29, 3, 2, 2, 2, 29, 3, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 31, 32, 9, 2, 2, 2, 32, 5, 3, 2, 2, 2, 33, 35, 5, 14, 8, 2, 34, 33, 3, 2, 2, 2, 34, 35, 3, 2, 2, 2, 35, 39, 3, 2, 2, 2, 36, 38, 5, 8, 5, 2, 37, 36, 3, 2, 2, 2, 38, 41, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 39, 40, 3, 2, 2, 2, 40, 7, 3, 2, 2, 2, 41, 39, 3, 2, 2, 2, 42, 43, 5, 10, 6, 2, 43, 9, 3, 2, 2, 2, 44, 46, 7, 11, 2, 2, 45, 47, 5, 12, 7, 2, 46, 45, 3, 2, 2, 2, 46, 47, 3, 2, 2, 2, 47, 11, 3, 2, 2, 2, 48, 49, 7, 5, 2, 2, 49, 13, 3, 2, 2, 2, 50, 53, 5, 16, 9, 2, 51, 53, 5, 18, 10, 2, 52, 50, 3, 2, 2, 2, 52, 51, 3, 2, 2, 2, 53, 15, 3, 2, 2, 2, 54, 57, 7, 6, 2, 2, 55, 58, 5, 18, 10, 2, 56, 58, 7, 11, 2, 2, 57, 55, 3, 2, 2, 2, 57, 56, 3, 2, 2, 2, 58, 59, 3, 2, 2, 2, 59, 62, 7, 7, 2, 2, 60, 63, 5, 18, 10, 2, 61, 63, 7, 11, 2, 2, 62, 60, 3, 2, 2, 2, 62, 61, 3, 2, 2, 2, 63, 64, 3, 2, 2, 2, 64, 65, 7, 8, 2, 2, 65, 17, 3, 2, 2, 2, 66, 67, 7, 10, 2, 2, 67, 19, 3, 2, 2, 2, 68, 69, 7, 9, 2, 2, 69, 21, 3, 2, 2, 2, 9, 28, 34, 39, 46, 52, 57, 62]
\ No newline at end of file
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 15, 83, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 29, 10, 2, 12, 2, 14, 2, 32, 11, 2, 3, 3, 3, 3, 3, 4, 5, 4, 37, 10, 4, 3, 4, 7, 4, 40, 10, 4, 12, 4, 14, 4, 43, 11, 4, 3, 5, 3, 5, 3, 6, 3, 6, 5, 6, 49, 10, 6, 3, 7, 3, 7, 3, 8, 3, 8, 5, 8, 55, 10, 8, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 61, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 67, 10, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 5, 12, 76, 10, 12, 3, 12, 5, 12, 79, 10, 12, 3, 12, 3, 12, 3, 12, 2, 2, 13, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 2, 4, 3, 2, 3, 4, 3, 2, 9, 10, 2, 82, 2, 24, 3, 2, 2, 2, 4, 33, 3, 2, 2, 2, 6, 36, 3, 2, 2, 2, 8, 44, 3, 2, 2, 2, 10, 46, 3, 2, 2, 2, 12, 50, 3, 2, 2, 2, 14, 54, 3, 2, 2, 2, 16, 56, 3, 2, 2, 2, 18, 70, 3, 2, 2, 2, 20, 72, 3, 2, 2, 2, 22, 75, 3, 2, 2, 2, 24, 30, 5, 6, 4, 2, 25, 26, 5, 4, 3, 2, 26, 27, 5, 6, 4, 2, 27, 29, 3, 2, 2, 2, 28, 25, 3, 2, 2, 2, 29, 32, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 3, 3, 2, 2, 2, 32, 30, 3, 2, 2, 2, 33, 34, 9, 2, 2, 2, 34, 5, 3, 2, 2, 2, 35, 37, 5, 14, 8, 2, 36, 35, 3, 2, 2, 2, 36, 37, 3, 2, 2, 2, 37, 41, 3, 2, 2, 2, 38, 40, 5, 8, 5, 2, 39, 38, 3, 2, 2, 2, 40, 43, 3, 2, 2, 2, 41, 39, 3, 2, 2, 2, 41, 42, 3, 2, 2, 2, 42, 7, 3, 2, 2, 2, 43, 41, 3, 2, 2, 2, 44, 45, 5, 10, 6, 2, 45, 9, 3, 2, 2, 2, 46, 48, 7, 13, 2, 2, 47, 49, 5, 12, 7, 2, 48, 47, 3, 2, 2, 2, 48, 49, 3, 2, 2, 2, 49, 11, 3, 2, 2, 2, 50, 51, 7, 5, 2, 2, 51, 13, 3, 2, 2, 2, 52, 55, 5, 16, 9, 2, 53, 55, 5, 18, 10, 2, 54, 52, 3, 2, 2, 2, 54, 53, 3, 2, 2, 2, 55, 15, 3, 2, 2, 2, 56, 60, 7, 6, 2, 2, 57, 61, 5, 18, 10, 2, 58, 61, 7, 13, 2, 2, 59, 61, 5, 22, 12, 2, 60, 57, 3, 2, 2, 2, 60, 58, 3, 2, 2, 2, 60, 59, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 62, 66, 7, 7, 2, 2, 63, 67, 5, 18, 10, 2, 64, 67, 7, 13, 2, 2, 65, 67, 5, 22, 12, 2, 66, 63, 3, 2, 2, 2, 66, 64, 3, 2, 2, 2, 66, 65, 3, 2, 2, 2, 67, 68, 3, 2, 2, 2, 68, 69, 7, 8, 2, 2, 69, 17, 3, 2, 2, 2, 70, 71, 7, 12, 2, 2, 71, 19, 3, 2, 2, 2, 72, 73, 7, 11, 2, 2, 73, 21, 3, 2, 2, 2, 74, 76, 7, 12, 2, 2, 75, 74, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 78, 3, 2, 2, 2, 77, 79, 9, 3, 2, 2, 78, 77, 3, 2, 2, 2, 78, 79, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 7, 13, 2, 2, 81, 23, 3, 2, 2, 2, 11, 30, 36, 41, 48, 54, 60, 66, 75, 78]
\ No newline at end of file
......@@ -4,14 +4,18 @@ T__2=3
T__3=4
T__4=5
T__5=6
COMMENT=7
REAL=8
INT=9
WS=10
EOL=11
T__6=7
T__7=8
COMMENT=9
REAL=10
INT=11
WS=12
EOL=13
'+'=1
'-'=2
'^'=3
'('=4
','=5
')'=6
'e'=7
'E'=8
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#include "FermionOperatorBaseListener.h"
......
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#pragma once
......@@ -48,6 +48,9 @@ public:
virtual void enterComment(FermionOperatorParser::CommentContext * /*ctx*/) override { }
virtual void exitComment(FermionOperatorParser::CommentContext * /*ctx*/) override { }
virtual void enterScientific(FermionOperatorParser::ScientificContext * /*ctx*/) override { }
virtual void exitScientific(FermionOperatorParser::ScientificContext * /*ctx*/) override { }
virtual void enterEveryRule(antlr4::ParserRuleContext * /*ctx*/) override { }
virtual void exitEveryRule(antlr4::ParserRuleContext * /*ctx*/) override { }
......
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#include "FermionOperatorLexer.h"
......@@ -61,8 +61,8 @@ atn::ATN FermionOperatorLexer::_atn;
std::vector<uint16_t> FermionOperatorLexer::_serializedATN;
std::vector<std::string> FermionOperatorLexer::_ruleNames = {
u8"T__0", u8"T__1", u8"T__2", u8"T__3", u8"T__4", u8"T__5", u8"COMMENT",
u8"REAL", u8"INT", u8"WS", u8"EOL"
u8"T__0", u8"T__1", u8"T__2", u8"T__3", u8"T__4", u8"T__5", u8"T__6",
u8"T__7", u8"COMMENT", u8"REAL", u8"INT", u8"WS", u8"EOL"
};
std::vector<std::string> FermionOperatorLexer::_channelNames = {
......@@ -74,11 +74,12 @@ std::vector<std::string> FermionOperatorLexer::_modeNames = {
};
std::vector<std::string> FermionOperatorLexer::_literalNames = {
"", u8"'+'", u8"'-'", u8"'^'", u8"'('", u8"','", u8"')'"
"", u8"'+'", u8"'-'", u8"'^'", u8"'('", u8"','", u8"')'", u8"'e'", u8"'E'"
};
std::vector<std::string> FermionOperatorLexer::_symbolicNames = {
"", "", "", "", "", "", "", u8"COMMENT", u8"REAL", u8"INT", u8"WS", u8"EOL"
"", "", "", "", "", "", "", "", "", u8"COMMENT", u8"REAL", u8"INT", u8"WS",
u8"EOL"
};
dfa::Vocabulary FermionOperatorLexer::_vocabulary(_literalNames, _symbolicNames);
......@@ -102,55 +103,61 @@ FermionOperatorLexer::Initializer::Initializer() {
_serializedATN = {
0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964,
0x2, 0xd, 0x48, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4,
0x2, 0xf, 0x50, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4,
0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, 0x9,
0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x4, 0xa, 0x9, 0xa, 0x4,
0xb, 0x9, 0xb, 0x4, 0xc, 0x9, 0xc, 0x3, 0x2, 0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0x2, 0x2, 0x46, 0x18, 0x3, 0x2, 0x2, 0x2, 0x47, 0x48, 0x9, 0x3, 0x2,
0x2, 0x48, 0x49, 0x3, 0x2, 0x2, 0x2, 0x49, 0x4a, 0x8, 0xd, 0x2, 0x2,
0x4a, 0x1a, 0x3, 0x2, 0x2, 0x2, 0x4b, 0x4d, 0x7, 0xf, 0x2, 0x2, 0x4c,
0x4b, 0x3, 0x2, 0x2, 0x2, 0x4c, 0x4d, 0x3, 0x2, 0x2, 0x2, 0x4d, 0x4e,
0x3, 0x2, 0x2, 0x2, 0x4e, 0x4f, 0x7, 0xc, 0x2, 0x2, 0x4f, 0x1c, 0x3,
0x2, 0x2, 0x2, 0x9, 0x2, 0x31, 0x37, 0x3a, 0x40, 0x45, 0x4c, 0x3, 0x8,
0x2, 0x2,
};
atn::ATNDeserializer deserializer;
......
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#pragma once
......@@ -13,8 +13,8 @@ namespace fermion {
class FermionOperatorLexer : public antlr4::Lexer {
public:
enum {
T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, COMMENT = 7,
REAL = 8, INT = 9, WS = 10, EOL = 11
T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, T__6 = 7,
T__7 = 8, COMMENT = 9, REAL = 10, INT = 11, WS = 12, EOL = 13
};
FermionOperatorLexer(antlr4::CharStream *input);
......
......@@ -6,6 +6,8 @@ null
'('
','
')'
'e'
'E'
null
null
null
......@@ -20,6 +22,8 @@ null
null
null
null
null
null
COMMENT
REAL
INT
......@@ -33,6 +37,8 @@ T__2
T__3
T__4
T__5
T__6
T__7
COMMENT
REAL
INT
......@@ -47,4 +53,4 @@ mode names:
DEFAULT_MODE
atn:
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 13, 72, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 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, 8, 3, 2, 2, 2, 31, 32, 7, 42, 2, 2, 32, 10, 3, 2, 2, 2, 33, 34, 7, 46, 2, 2, 34, 12, 3, 2, 2, 2, 35, 36, 7, 43, 2, 2, 36, 14, 3, 2, 2, 2, 37, 41, 7, 37, 2, 2, 38, 40, 10, 2, 2, 2, 39, 38, 3, 2, 2, 2, 40, 43, 3, 2, 2, 2, 41, 39, 3, 2, 2, 2, 41, 42, 3, 2, 2, 2, 42, 44, 3, 2, 2, 2, 43, 41, 3, 2, 2, 2, 44, 45, 5, 23, 12, 2, 45, 16, 3, 2, 2, 2, 46, 48, 7, 47, 2, 2, 47, 46, 3, 2, 2, 2, 47, 48, 3, 2, 2, 2, 48, 50, 3, 2, 2, 2, 49, 51, 5, 19, 10, 2, 50, 49, 3, 2, 2, 2, 50, 51, 3, 2, 2, 2, 51, 52, 3, 2, 2, 2, 52, 53, 7, 48, 2, 2, 53, 54, 5, 19, 10, 2, 54, 18, 3, 2, 2, 2, 55, 57, 7, 47, 2, 2, 56, 55, 3, 2, 2, 2, 56, 57, 3, 2, 2, 2, 57, 59, 3, 2, 2, 2, 58, 60, 4, 50, 59, 2, 59, 58, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 59, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 62, 20, 3, 2, 2, 2, 63, 64, 9, 3, 2, 2, 64, 65, 3, 2, 2, 2, 65, 66, 8, 11, 2, 2, 66, 22, 3, 2, 2, 2, 67, 69, 7, 15, 2, 2, 68, 67, 3, 2, 2, 2, 68, 69, 3, 2, 2, 2, 69, 70, 3, 2, 2, 2, 70, 71, 7, 12, 2, 2, 71, 24, 3, 2, 2, 2, 9, 2, 41, 47, 50, 56, 61, 68, 3, 8, 2, 2]
\ No newline at end of file
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 15, 80, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 7, 10, 48, 10, 10, 12, 10, 14, 10, 51, 11, 10, 3, 10, 3, 10, 3, 11, 5, 11, 56, 10, 11, 3, 11, 5, 11, 59, 10, 11, 3, 11, 3, 11, 3, 11, 3, 12, 5, 12, 65, 10, 12, 3, 12, 6, 12, 68, 10, 12, 13, 12, 14, 12, 69, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 5, 14, 77, 10, 14, 3, 14, 3, 14, 2, 2, 15, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 3, 2, 4, 4, 2, 12, 12, 15, 15, 5, 2, 11, 12, 15, 15, 34, 34, 2, 85, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 3, 29, 3, 2, 2, 2, 5, 31, 3, 2, 2, 2, 7, 33, 3, 2, 2, 2, 9, 35, 3, 2, 2, 2, 11, 37, 3, 2, 2, 2, 13, 39, 3, 2, 2, 2, 15, 41, 3, 2, 2, 2, 17, 43, 3, 2, 2, 2, 19, 45, 3, 2, 2, 2, 21, 55, 3, 2, 2, 2, 23, 64, 3, 2, 2, 2, 25, 71, 3, 2, 2, 2, 27, 76, 3, 2, 2, 2, 29, 30, 7, 45, 2, 2, 30, 4, 3, 2, 2, 2, 31, 32, 7, 47, 2, 2, 32, 6, 3, 2, 2, 2, 33, 34, 7, 96, 2, 2, 34, 8, 3, 2, 2, 2, 35, 36, 7, 42, 2, 2, 36, 10, 3, 2, 2, 2, 37, 38, 7, 46, 2, 2, 38, 12, 3, 2, 2, 2, 39, 40, 7, 43, 2, 2, 40, 14, 3, 2, 2, 2, 41, 42, 7, 103, 2, 2, 42, 16, 3, 2, 2, 2, 43, 44, 7, 71, 2, 2, 44, 18, 3, 2, 2, 2, 45, 49, 7, 37, 2, 2, 46, 48, 10, 2, 2, 2, 47, 46, 3, 2, 2, 2, 48, 51, 3, 2, 2, 2, 49, 47, 3, 2, 2, 2, 49, 50, 3, 2, 2, 2, 50, 52, 3, 2, 2, 2, 51, 49, 3, 2, 2, 2, 52, 53, 5, 27, 14, 2, 53, 20, 3, 2, 2, 2, 54, 56, 7, 47, 2, 2, 55, 54, 3, 2, 2, 2, 55, 56, 3, 2, 2, 2, 56, 58, 3, 2, 2, 2, 57, 59, 5, 23, 12, 2, 58, 57, 3, 2, 2, 2, 58, 59, 3, 2, 2, 2, 59, 60, 3, 2, 2, 2, 60, 61, 7, 48, 2, 2, 61, 62, 5, 23, 12, 2, 62, 22, 3, 2, 2, 2, 63, 65, 7, 47, 2, 2, 64, 63, 3, 2, 2, 2, 64, 65, 3, 2, 2, 2, 65, 67, 3, 2, 2, 2, 66, 68, 4, 50, 59, 2, 67, 66, 3, 2, 2, 2, 68, 69, 3, 2, 2, 2, 69, 67, 3, 2, 2, 2, 69, 70, 3, 2, 2, 2, 70, 24, 3, 2, 2, 2, 71, 72, 9, 3, 2, 2, 72, 73, 3, 2, 2, 2, 73, 74, 8, 13, 2, 2, 74, 26, 3, 2, 2, 2, 75, 77, 7, 15, 2, 2, 76, 75, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 78, 3, 2, 2, 2, 78, 79, 7, 12, 2, 2, 79, 28, 3, 2, 2, 2, 9, 2, 49, 55, 58, 64, 69, 76, 3, 8, 2, 2]
\ No newline at end of file
......@@ -4,14 +4,18 @@ T__2=3
T__3=4
T__4=5
T__5=6
COMMENT=7
REAL=8
INT=9
WS=10
EOL=11
T__6=7
T__7=8
COMMENT=9
REAL=10
INT=11
WS=12
EOL=13
'+'=1
'-'=2
'^'=3
'('=4
','=5
')'=6
'e'=7
'E'=8
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#include "FermionOperatorListener.h"
......
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#pragma once
......@@ -46,6 +46,9 @@ public:
virtual void enterComment(FermionOperatorParser::CommentContext *ctx) = 0;
virtual void exitComment(FermionOperatorParser::CommentContext *ctx) = 0;
virtual void enterScientific(FermionOperatorParser::ScientificContext *ctx) = 0;
virtual void exitScientific(FermionOperatorParser::ScientificContext *ctx) = 0;
};
......
// Generated from FermionOperator.g4 by ANTLR 4.7.2
// Generated from FermionOperator.g4 by ANTLR 4.8
#include "FermionOperatorListener.h"
......@@ -81,19 +81,19 @@ FermionOperatorParser::FermionSrcContext* FermionOperatorParser::fermionSrc() {
});
try {
enterOuterAlt(_localctx, 1);
setState(20);
setState(22);
term();
setState(26);
setState(28);
_errHandler->sync(this);
_la = _input->LA(1);
while (_la == FermionOperatorParser::T__0
|| _la == FermionOperatorParser::T__1) {
setState(21);
setState(23);
plusorminus();
setState(22);
setState(24);
term();
setState(28);
setState(30);
_errHandler->sync(this);
_la = _input->LA(1);
}
......@@ -141,7 +141,7 @@ FermionOperatorParser::PlusorminusContext* FermionOperatorParser::plusorminus()
});
try {
enterOuterAlt(_localctx, 1);
setState(29);
setState(31);
_la = _input->LA(1);
if (!(_la == FermionOperatorParser::T__0
......@@ -208,23 +208,23 @@ FermionOperatorParser::TermContext* FermionOperatorParser::term() {
});
try {
enterOuterAlt(_localctx, 1);
setState(32);
setState(34);
_errHandler->sync(this);
_la = _input->LA(1);
if (_la == FermionOperatorParser::T__3
|| _la == FermionOperatorParser::REAL) {
setState(31);
setState(33);
coeff();
}
setState(37);
setState(39);
_errHandler->sync(this);
_la = _input->LA(1);
while (_la == FermionOperatorParser::INT) {
setState(34);
setState(36);
fermion();
setState(39);
setState(41);
_errHandler->sync(this);
_la = _input->LA(1);
}
......@@ -275,7 +275,7 @@ FermionOperatorParser::FermionContext* FermionOperatorParser::fermion() {
});
try {
enterOuterAlt(_localctx, 1);
setState(40);
setState(42);
op();
}
......@@ -329,14 +329,14 @@ FermionOperatorParser::OpContext* FermionOperatorParser::op() {
});
try {
enterOuterAlt(_localctx, 1);
setState(42);
match(FermionOperatorParser::INT);
setState(44);
match(FermionOperatorParser::INT);
setState(46);
_errHandler->sync(this);
_la = _input->LA(1);
if (_la == FermionOperatorParser::T__2) {
setState(43);
setState(45);
carat();
}
......@@ -382,7 +382,7 @@ FermionOperatorParser::CaratContext* FermionOperatorParser::carat() {
});
try {
enterOuterAlt(_localctx, 1);
setState(46);
setState(48);
match(FermionOperatorParser::T__2);
}
......@@ -434,19 +434,19 @@ FermionOperatorParser::CoeffContext* FermionOperatorParser::coeff() {
exitRule();
});
try {
setState(50);
setState(52);
_errHandler->sync(this);
switch (_input->LA(1)) {
case FermionOperatorParser::T__3: {
enterOuterAlt(_localctx, 1);
setState(48);
setState(50);
complex();
break;
}
case FermionOperatorParser::REAL: {
enterOuterAlt(_localctx, 2);
setState(49);
setState(51);
real();
break;
}
......@@ -487,6 +487,14 @@ tree::TerminalNode* FermionOperatorParser::ComplexContext::INT(size_t i) {
return getToken(FermionOperatorParser::INT, i);
}
std::vector<FermionOperatorParser::ScientificContext *> FermionOperatorParser::ComplexContext::scientific() {
return getRuleContexts<FermionOperatorParser::ScientificContext>();
}
FermionOperatorParser::ScientificContext* FermionOperatorParser::ComplexContext::scientific(size_t i) {
return getRuleContext<FermionOperatorParser::ScientificContext>(i);
}
size_t FermionOperatorParser::ComplexContext::getRuleIndex() const {
return FermionOperatorParser::RuleComplex;
......@@ -513,47 +521,55 @@ FermionOperatorParser::ComplexContext* FermionOperatorParser::complex() {
});
try {
enterOuterAlt(_localctx, 1);
setState(52);
setState(54);
match(FermionOperatorParser::T__3);
setState(55);
setState(58);
_errHandler->sync(this);
switch (_input->LA(1)) {
case FermionOperatorParser::REAL: {
setState(53);
real();
break;
}
switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 5, _ctx)) {
case 1: {
setState(55);
real();
break;
}
case FermionOperatorParser::INT: {
setState(54);
match(FermionOperatorParser::INT);
break;
}
case 2: {
setState(56);
match(FermionOperatorParser::INT);
break;
}
case 3: {
setState(57);
scientific();
break;
}
default:
throw NoViableAltException(this);
}
setState(57);
match(FermionOperatorParser::T__4);
setState(60);
match(FermionOperatorParser::T__4);
setState(64);
_errHandler->sync(this);
switch (_input->LA(1)) {
case FermionOperatorParser::REAL: {
setState(58);
real();
break;
}
switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 6, _ctx)) {
case 1: {
setState(61);
real();
break;
}
case FermionOperatorParser::INT: {
setState(59);
match(FermionOperatorParser::INT);
break;
}
case 2: {
setState(62);
match(FermionOperatorParser::INT);
break;
}
case 3: {
setState(63);
scientific();
break;
}