Skip to content

Commit

Permalink
Revert "Merge pull request drasil#5 from alpercoskun/master" because …
Browse files Browse the repository at this point in the history
…it breaks compilation of the JavaLibrary

This reverts commit bf0a9f5, reversing
changes made to 60c79f4.
  • Loading branch information
drasil authored and tisoft committed Oct 12, 2022
1 parent 8864d35 commit c5fb484
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 42 deletions.
29 changes: 12 additions & 17 deletions BNCompiler/src/main/antlr/org/bn/compiler/parser/ASN1.g
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,9 @@ boolean_type returns [Object obj]
;
choice_type returns [Object obj]
{AsnChoice ch = new AsnChoice(); List<AsnElementType> eltplst ;
{AsnChoice ch = new AsnChoice(); AsnElementTypeList eltplst ;
obj = null;}
: ( CHOICE_KW L_BRACE (eltplst = elementType_list {ch.componentTypes = eltplst ;}) R_BRACE )
: ( CHOICE_KW L_BRACE (eltplst = elementType_list {ch.elementTypeList = eltplst ;}) R_BRACE )
{obj = ch; eltplst = null; ch = null;}
;
Expand Down Expand Up @@ -649,10 +649,10 @@ relativeOid_type returns [Object obj]
sequence_type returns [Object obj]
{AsnSequenceSet seq = new AsnSequenceSet();
List<AsnElementType> eltplist ; obj = null;}
AsnElementTypeList eltplist ; obj = null;}
: ( SEQUENCE_KW {seq.isSequence = true;}
L_BRACE
(eltplist = elementType_list {seq.componentTypes = eltplist;})?
(eltplist = elementType_list {seq.elementTypeList = eltplist;})?
R_BRACE )
{obj = seq ; eltplist = null; seq =null; }
;
Expand All @@ -676,8 +676,8 @@ AsnConstraint cns; obj = null; Object obj1 ; String s ;}
set_type returns [Object obj]
{AsnSequenceSet set = new AsnSequenceSet();
List<AsnElementType> eltplist ;obj = null;}
: ( SET_KW L_BRACE (eltplist = elementType_list {set.componentTypes = eltplist ;})? R_BRACE )
AsnElementTypeList eltplist ;obj = null;}
: ( SET_KW L_BRACE (eltplist = elementType_list {set.elementTypeList = eltplist ;})? R_BRACE )
{obj = set ; eltplist = null; set = null;}
;
Expand Down Expand Up @@ -857,15 +857,10 @@ typeorvalue returns [Object obj]
{obj = obj1; obj1=null;}
;
elementType_list returns [List<AsnElementType> elelist]
{elelist = new ArrayList<>(); AsnElementType eletyp; int i=1; }
: (ELLIPSIS | eletyp = elementType {if (eletyp.name.isEmpty()) {
eletyp.name = "element" + i;
};
elelist.add(eletyp);
i++;
}
(COMMA (ELLIPSIS | (eletyp = elementType {if (eletyp.name.isEmpty()) {eletyp.name = "element" + i;};elelist.add(eletyp);i++; })))*)
elementType_list returns [AsnElementTypeList elelist]
{elelist = new AsnElementTypeList(); AsnElementType eletyp; }
: (eletyp = elementType {elelist.elements.add(eletyp); }
(COMMA (eletyp = elementType {elelist.elements.add(eletyp);}))*)
;
elementType returns [AsnElementType eletyp]
Expand All @@ -890,8 +885,8 @@ Object obj; AsnTag tg; String s;}
namedNumber_list returns [AsnNamedNumberList nnlist]
{nnlist = new AsnNamedNumberList();AsnNamedNumber nnum ; }
: ( L_BRACE (ELLIPSIS | nnum= namedNumber {nnlist.namedNumbers.add(nnum); })
(COMMA ( ELLIPSIS | (nnum = namedNumber {nnlist.namedNumbers.add(nnum); }) ))* R_BRACE )
: ( L_BRACE (nnum= namedNumber {nnlist.namedNumbers.add(nnum); })
(COMMA (nnum = namedNumber {nnlist.namedNumbers.add(nnum); }) )* R_BRACE )
;
namedNumber returns [AsnNamedNumber nnum]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
package org.bn.compiler.parser.model;

import java.util.ArrayList;
import java.util.List;

public class AsnChoice {

final String BUILTINTYPE = "CHOICE";
public List<AsnElementType> componentTypes;
public String name;
public final boolean isChoice = true;
final String BUILTINTYPE = "CHOICE";
public AsnElementTypeList elementTypeList;
public String name;
public final boolean isChoice = true;

public AsnChoice() {
name = "";
componentTypes = new ArrayList<>();
name = "";
}

@Override
public String toString() {
String ts = name + "\t::=\t" + BUILTINTYPE + "\t {";

if (componentTypes != null) {
for (AsnElementType elementType: componentTypes) {
if (elementTypeList != null) {
for (AsnElementType elementType: elementTypeList.elements) {
ts += elementType;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class AsnElementType {

public AsnElementType() {
isOptional = false;
name = "";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package org.bn.compiler.parser.model;

import java.util.ArrayList;
import java.util.List;

public class AsnSequenceSet {

final String BUILTINTYPE = "SEQUENCE";
final String BUILTINTYPE1 = "SET";
public List<AsnElementType> componentTypes;
public boolean isSequence;
public String name; // Name of Sequence
final String BUILTINTYPE = "SEQUENCE";
final String BUILTINTYPE1 = "SET";
public AsnElementTypeList elementTypeList;
public boolean isSequence;
public String name; // Name of Sequence

public AsnSequenceSet() {
name = "";
isSequence = false;
componentTypes = new ArrayList<>();
name = "";
isSequence = false;
}

@Override
Expand All @@ -29,8 +25,8 @@ public String toString() {

ts += "{";

if (componentTypes != null) {
for (AsnElementType elementType: componentTypes) {
if (elementTypeList != null) {
for (AsnElementType elementType: elementTypeList.elements) {
ts += elementType;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AsnConstraint
AsnDefinedType
AsnDefinedValue
AsnElementType
AsnElementTypeList
AsnEmbedded
AsnEnum
AsnExternal
Expand Down

0 comments on commit c5fb484

Please sign in to comment.