Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,7 @@ For multisegment variable lengths tests:
## Changelog
- #### 2.4.4 will be released soon.
- [#435](https://github.com/AbsaOSS/cobrix/issues/435) Fixed 'INDEXED BY' clause followed by multiple identifiers.
- [#437](https://github.com/AbsaOSS/cobrix/issues/437) Added support for '@' characters inside identifier names.

- #### 2.4.3 released 26 October 2021.
- [#430](https://github.com/AbsaOSS/cobrix/issues/430) Added support for 'twisted' RDW headers when big-endian or little-endian RDWs use unexpected RDW bytes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ fragment SIGN_CHAR:

// identifiers
SINGLE_QUOTED_IDENTIFIER: '\'' IDENTIFIER '\'' ([-_]* [a-zA-Z0-9]+)+;
IDENTIFIER: [a-zA-Z0-9:]+ [-_:a-zA-Z0-9]*;
IDENTIFIER: [a-zA-Z0-9:]+ [-_@:a-zA-Z0-9]*;

// case insensitive chars
fragment A:('a'|'A');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public copybookLexer(CharStream input) {
"\2\u012d\2\u012f\2\u0131\2\u0133\2\u0135\2\u0137\2\u0139\2\u013b\2\u013d"+
"\2\u013f\u0084\u0141\u0085\3\2*\5\2\13\f\16\17\"\"\4\2\f\f\17\17\4\2\62"+
";CH\5\2\f\f\17\17$$\5\2\f\f\17\17))\3\2\64;\3\2\63\66\3\2\62;\3\2\63;"+
"\4\2//aa\5\2\62;C\\c|\5\2\62<C\\c|\7\2//\62<C\\aac|\4\2CCcc\4\2DDdd\4"+
"\4\2//aa\5\2\62;C\\c|\5\2\62<C\\c|\7\2//\62<B\\aac|\4\2CCcc\4\2DDdd\4"+
"\2EEee\4\2FFff\4\2GGgg\4\2HHhh\4\2IIii\4\2JJjj\4\2KKkk\4\2LLll\4\2MMm"+
"m\4\2NNnn\4\2OOoo\4\2PPpp\4\2QQqq\4\2RRrr\4\2SSss\4\2TTtt\4\2UUuu\4\2"+
"VVvv\4\2WWww\4\2XXxx\4\2YYyy\4\2ZZzz\4\2[[{{\4\2\\\\||\5\2\13\f\17\17"+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.slf4j.{Logger, LoggerFactory}
import za.co.absa.cobrix.cobol.parser.CopybookParser
import za.co.absa.cobrix.cobol.testutils.SimpleComparisonBase

class ParseCopybooksFeauresSpec extends FunSuite with SimpleComparisonBase {
class ParseCopybookFeaturesSpec extends FunSuite with SimpleComparisonBase {
private implicit val logger: Logger = LoggerFactory.getLogger(this.getClass)

test("Test copybooks with indexed by clauses with multiple indexes separated by comma") {
Expand Down Expand Up @@ -71,4 +71,24 @@ class ParseCopybooksFeauresSpec extends FunSuite with SimpleComparisonBase {

assertEqualsMultiline(layout, expectedLayout)
}

test("Test copybooks containing identifiers with '@'") {
val copybookContents =
"""
01 ROOT-GROUP.
05 F@TEST PIC X(1).
"""

val expectedLayout =
"""-------- FIELD LEVEL/NAME --------- --ATTRIBS-- FLD START END LENGTH
|
|1 ROOT_GROUP 1 1 1 1
| 5 F@TEST 2 1 1 1"""
.stripMargin.replace("\r\n", "\n")

val copybook = CopybookParser.parseTree(copybookContents)
val layout = copybook.generateRecordLayoutPositions()

assertEqualsMultiline(layout, expectedLayout)
}
}