Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAPI-573 Add in default support for set of #697

Merged
merged 3 commits into from
Mar 28, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ opts:
opt:
maxlength
| maxcount
| setdefaultvalall
| setdefaultval
| defaultval
| xpath
| xmldefaultval
Expand All @@ -93,7 +95,7 @@ maxcount:
;

defaultval:
'DEFAULT' OPAREN STRING CPAREN
('DEFAULT' OPAREN STRING CPAREN)
;

xpath:
Expand All @@ -104,6 +106,13 @@ xmldefaultval:
'XMLDEFAULT' OPAREN STRING CPAREN
;

setdefaultval:
'DEFAULT' OPAREN SETSTRING CPAREN
;
setdefaultvalall:
'DEFAULT' OPAREN 'ALL' CPAREN
;

annotation_name : ATOKEN;
annotation_param : (TOKEN|UTOKEN);
annotation_arguments : annotation_param (COMMA annotation_param)*;
Expand All @@ -114,6 +123,8 @@ comment:
( '/*' annotation? (COMMA annotation)* .*? (.*?'*/' | '*/'))
;

OSQUARE : '[';
CSQUARE : ']';
OPAREN : '(';
CPAREN : ')';
OCURLY : '{';
Expand All @@ -130,9 +141,11 @@ DATASET_SYM : 'DATASET';
WS : [ \t\r\n] -> skip;
INT : [0-9]+ ;
fragment ESCAPED_QUOTE : '\\\'';
SETSTRING : '[\'' ( ESCAPED_QUOTE | SETTOKEN | ('\'') | ~(']'))* '\']';
STRING : '\'' ( ESCAPED_QUOTE | ~('\'') )* '\'';
ATOKEN: [@][a-zA-Z0-9_-]+[a-zA-Z0-9_];
TOKEN : ~[_\r\n\t; (),:={}-]~[\r\n \t;(),:={}-]* ;
UTOKEN: [_]+[a-zA-Z0-9_-]+[a-zA-Z0-9_];
ECL_NUMBERED_TYPE: TOKEN INT?;
SETTOKEN: [a-zA-Z0-9,_-];

Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,72 @@ else if (currentrec != null)
}
}


@Override
public void enterSetdefaultvalall(EclRecordParser.SetdefaultvalallContext ctx)
{
String val = ctx.getChild(2).getText();
val = val.replace("'", "");

if (currentfield != null)
{
currentfield.setColumnValue(val);
}
else if (currentrec != null)
{
currentrec.setColumnValue(val);
}
}


/**
* {@inheritDoc}
*
* <p>
* When entering a DEFAULT option for Set Of, set the columnvalue of the current field/rec to its value
* </p>
*/
@Override
public void enterSetdefaultval(EclRecordParser.SetdefaultvalContext ctx)
{
String val = ctx.getChild(2).getText();
if(val.length() >= 2)
{
if(val.substring(0, 2).equals("['"))
{
val = val.substring(2, val.length());
}
}
if(val.length() >= 2)
{
if(val.substring(val.length()-2, val.length()).equals("']"))
{
val = val.substring(0, val.length() - 2);
}
}
val = val.replace("']", "");

if(val.contains("','"))
{
if(!val.startsWith("'"))
{
val = "'" + val;
}
if(!val.endsWith("'"))
{
val = val + "'";
}
}
if (currentfield != null)
{
currentfield.setColumnValue(val);
}
else if (currentrec != null)
{
currentrec.setColumnValue(val);
}
}

/**
* {@inheritDoc}
*
Expand All @@ -407,10 +473,12 @@ else if (currentrec != null)
public void enterXpath(EclRecordParser.XpathContext ctx)
{
String val = ctx.getChild(2).getText();
if (val.startsWith("'")) {
if (val.startsWith("'"))
{
val=val.substring(1);
}
if (val.endsWith("'")) {
if (val.endsWith("'"))
{
val=val.substring(0,val.length()-1);
}
if (currentfield != null)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,29 @@ T__11=12
T__12=13
T__13=14
T__14=15
OPAREN=16
CPAREN=17
OCURLY=18
CCURLY=19
COMMA=20
SEMI=21
EQ=22
ASSING_SYM=23
REC_SYM=24
END_SYM=25
DATASET_SYM=26
WS=27
INT=28
STRING=29
ATOKEN=30
TOKEN=31
UTOKEN=32
ECL_NUMBERED_TYPE=33
T__15=16
OSQUARE=17
CSQUARE=18
OPAREN=19
CPAREN=20
OCURLY=21
CCURLY=22
COMMA=23
SEMI=24
EQ=25
ASSING_SYM=26
REC_SYM=27
END_SYM=28
DATASET_SYM=29
WS=30
INT=31
SETSTRING=32
STRING=33
ATOKEN=34
TOKEN=35
UTOKEN=36
ECL_NUMBERED_TYPE=37
SETTOKEN=38
'SET OF'=1
'set of'=2
'MAXLENGTH'=3
Expand All @@ -43,16 +48,19 @@ ECL_NUMBERED_TYPE=33
'DEFAULT'=10
'XPATH'=11
'XMLDEFAULT'=12
'//'=13
'/*'=14
'*/'=15
'('=16
')'=17
'{'=18
'}'=19
','=20
'='=22
':='=23
'RECORD'=24
'END'=25
'DATASET'=26
'ALL'=13
'//'=14
'/*'=15
'*/'=16
'['=17
']'=18
'('=19
')'=20
'{'=21
'}'=22
','=23
'='=25
':='=26
'RECORD'=27
'END'=28
'DATASET'=29
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,30 @@ public class EclRecordBaseListener implements EclRecordListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitXmldefaultval(EclRecordParser.XmldefaultvalContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSetdefaultval(EclRecordParser.SetdefaultvalContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSetdefaultval(EclRecordParser.SetdefaultvalContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSetdefaultvalall(EclRecordParser.SetdefaultvalallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSetdefaultvalall(EclRecordParser.SetdefaultvalallContext ctx) { }
/**
* {@inheritDoc}
*
Expand Down

Large diffs are not rendered by default.

Loading
Loading