From de712b4b0b95dabf3216fa4a0a05e0e84640a01e Mon Sep 17 00:00:00 2001 From: Timofey X Date: Sun, 18 Feb 2024 18:59:23 +0700 Subject: [PATCH] [cocas] Export lower_part into object file --- .../object_file/generated/ObjectFileLexer.py | 156 ++--- .../object_file/generated/ObjectFileParser.py | 555 +++++++++++------- .../generated/ObjectFileParserVisitor.py | 10 + cocas/object_file/grammar/ObjectFileLexer.g4 | 1 + cocas/object_file/grammar/ObjectFileParser.g4 | 3 +- cocas/object_file/object_import.py | 6 +- cocas/object_module/external_entry.py | 4 +- 7 files changed, 440 insertions(+), 295 deletions(-) diff --git a/cocas/object_file/generated/ObjectFileLexer.py b/cocas/object_file/generated/ObjectFileLexer.py index e71fd2f5..3390115f 100644 --- a/cocas/object_file/generated/ObjectFileLexer.py +++ b/cocas/object_file/generated/ObjectFileLexer.py @@ -10,70 +10,71 @@ def serializedATN(): return [ - 4,0,23,180,6,-1,6,-1,6,-1,6,-1,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3, + 4,0,24,184,6,-1,6,-1,6,-1,6,-1,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3, 7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2, 11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7, - 17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,1,0,1,0,1,0, - 1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,3, - 1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6, - 1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,9, - 1,9,1,9,1,10,4,10,106,8,10,11,10,12,10,107,1,11,1,11,1,11,1,11,1, - 11,1,12,1,12,1,13,1,13,1,14,3,14,120,8,14,1,14,4,14,123,8,14,11, - 14,12,14,124,1,15,4,15,128,8,15,11,15,12,15,129,1,15,1,15,1,16,3, - 16,135,8,16,1,16,4,16,138,8,16,11,16,12,16,139,1,16,1,16,1,17,4, - 17,145,8,17,11,17,12,17,146,1,18,4,18,150,8,18,11,18,12,18,151,1, - 19,4,19,155,8,19,11,19,12,19,156,1,19,1,19,1,20,1,20,1,20,1,20,1, - 20,1,21,4,21,167,8,21,11,21,12,21,168,1,21,1,21,1,21,1,22,4,22,175, - 8,22,11,22,12,22,176,1,22,1,22,0,0,23,5,1,7,2,9,3,11,4,13,5,15,6, - 17,7,19,8,21,9,23,10,25,11,27,12,29,13,31,14,33,15,35,16,37,17,39, - 18,41,19,43,20,45,21,47,22,49,23,5,0,1,2,3,4,4,4,0,48,57,65,90,95, - 95,97,122,2,0,9,9,32,32,6,0,9,9,32,32,48,57,65,90,95,95,97,122,2, - 0,10,10,13,13,186,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0, - 0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0, - 0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0, - 0,0,33,1,0,0,0,0,35,1,0,0,0,1,37,1,0,0,0,1,39,1,0,0,0,2,41,1,0,0, - 0,2,43,1,0,0,0,2,45,1,0,0,0,3,47,1,0,0,0,4,49,1,0,0,0,5,51,1,0,0, - 0,7,56,1,0,0,0,9,63,1,0,0,0,11,69,1,0,0,0,13,73,1,0,0,0,15,78,1, - 0,0,0,17,83,1,0,0,0,19,88,1,0,0,0,21,95,1,0,0,0,23,99,1,0,0,0,25, - 105,1,0,0,0,27,109,1,0,0,0,29,114,1,0,0,0,31,116,1,0,0,0,33,122, - 1,0,0,0,35,127,1,0,0,0,37,137,1,0,0,0,39,144,1,0,0,0,41,149,1,0, - 0,0,43,154,1,0,0,0,45,160,1,0,0,0,47,166,1,0,0,0,49,174,1,0,0,0, - 51,52,5,84,0,0,52,53,5,65,0,0,53,54,5,82,0,0,54,55,5,71,0,0,55,6, - 1,0,0,0,56,57,5,70,0,0,57,58,5,73,0,0,58,59,5,76,0,0,59,60,5,69, - 0,0,60,61,1,0,0,0,61,62,6,1,0,0,62,8,1,0,0,0,63,64,5,65,0,0,64,65, - 5,66,0,0,65,66,5,83,0,0,66,67,1,0,0,0,67,68,6,2,1,0,68,10,1,0,0, - 0,69,70,5,76,0,0,70,71,5,79,0,0,71,72,5,67,0,0,72,12,1,0,0,0,73, - 74,5,78,0,0,74,75,5,84,0,0,75,76,5,82,0,0,76,77,5,89,0,0,77,14,1, - 0,0,0,78,79,5,78,0,0,79,80,5,65,0,0,80,81,5,77,0,0,81,82,5,69,0, - 0,82,16,1,0,0,0,83,84,5,65,0,0,84,85,5,76,0,0,85,86,5,73,0,0,86, - 87,5,71,0,0,87,18,1,0,0,0,88,89,5,68,0,0,89,90,5,65,0,0,90,91,5, - 84,0,0,91,92,5,65,0,0,92,93,1,0,0,0,93,94,6,7,2,0,94,20,1,0,0,0, - 95,96,5,82,0,0,96,97,5,69,0,0,97,98,5,76,0,0,98,22,1,0,0,0,99,100, - 5,88,0,0,100,101,5,84,0,0,101,102,5,82,0,0,102,103,5,78,0,0,103, - 24,1,0,0,0,104,106,7,0,0,0,105,104,1,0,0,0,106,107,1,0,0,0,107,105, - 1,0,0,0,107,108,1,0,0,0,108,26,1,0,0,0,109,110,5,36,0,0,110,111, - 5,97,0,0,111,112,5,98,0,0,112,113,5,115,0,0,113,28,1,0,0,0,114,115, - 5,58,0,0,115,30,1,0,0,0,116,117,5,45,0,0,117,32,1,0,0,0,118,120, - 5,13,0,0,119,118,1,0,0,0,119,120,1,0,0,0,120,121,1,0,0,0,121,123, - 5,10,0,0,122,119,1,0,0,0,123,124,1,0,0,0,124,122,1,0,0,0,124,125, - 1,0,0,0,125,34,1,0,0,0,126,128,7,1,0,0,127,126,1,0,0,0,128,129,1, - 0,0,0,129,127,1,0,0,0,129,130,1,0,0,0,130,131,1,0,0,0,131,132,6, - 15,3,0,132,36,1,0,0,0,133,135,5,13,0,0,134,133,1,0,0,0,134,135,1, - 0,0,0,135,136,1,0,0,0,136,138,5,10,0,0,137,134,1,0,0,0,138,139,1, - 0,0,0,139,137,1,0,0,0,139,140,1,0,0,0,140,141,1,0,0,0,141,142,6, - 16,4,0,142,38,1,0,0,0,143,145,7,2,0,0,144,143,1,0,0,0,145,146,1, - 0,0,0,146,144,1,0,0,0,146,147,1,0,0,0,147,40,1,0,0,0,148,150,7,0, - 0,0,149,148,1,0,0,0,150,151,1,0,0,0,151,149,1,0,0,0,151,152,1,0, - 0,0,152,42,1,0,0,0,153,155,7,1,0,0,154,153,1,0,0,0,155,156,1,0,0, - 0,156,154,1,0,0,0,156,157,1,0,0,0,157,158,1,0,0,0,158,159,6,19,3, - 0,159,44,1,0,0,0,160,161,5,58,0,0,161,162,1,0,0,0,162,163,6,20,4, - 0,163,164,6,20,2,0,164,46,1,0,0,0,165,167,5,32,0,0,166,165,1,0,0, - 0,167,168,1,0,0,0,168,166,1,0,0,0,168,169,1,0,0,0,169,170,1,0,0, - 0,170,171,6,21,4,0,171,172,6,21,5,0,172,48,1,0,0,0,173,175,8,3,0, - 0,174,173,1,0,0,0,175,176,1,0,0,0,176,174,1,0,0,0,176,177,1,0,0, - 0,177,178,1,0,0,0,178,179,6,22,4,0,179,50,1,0,0,0,16,0,1,2,3,4,107, - 119,124,129,134,139,146,151,156,168,176,6,5,3,0,5,2,0,5,1,0,6,0, - 0,4,0,0,5,4,0 + 17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,1, + 0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1, + 2,1,2,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1, + 6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1, + 9,1,9,1,9,1,9,1,9,1,10,4,10,108,8,10,11,10,12,10,109,1,11,1,11,1, + 11,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,3,15,124,8,15,1, + 15,4,15,127,8,15,11,15,12,15,128,1,16,4,16,132,8,16,11,16,12,16, + 133,1,16,1,16,1,17,3,17,139,8,17,1,17,4,17,142,8,17,11,17,12,17, + 143,1,17,1,17,1,18,4,18,149,8,18,11,18,12,18,150,1,19,4,19,154,8, + 19,11,19,12,19,155,1,20,4,20,159,8,20,11,20,12,20,160,1,20,1,20, + 1,21,1,21,1,21,1,21,1,21,1,22,4,22,171,8,22,11,22,12,22,172,1,22, + 1,22,1,22,1,23,4,23,179,8,23,11,23,12,23,180,1,23,1,23,0,0,24,5, + 1,7,2,9,3,11,4,13,5,15,6,17,7,19,8,21,9,23,10,25,11,27,12,29,13, + 31,14,33,15,35,16,37,17,39,18,41,19,43,20,45,21,47,22,49,23,51,24, + 5,0,1,2,3,4,4,4,0,48,57,65,90,95,95,97,122,2,0,9,9,32,32,6,0,9,9, + 32,32,48,57,65,90,95,95,97,122,2,0,10,10,13,13,190,0,5,1,0,0,0,0, + 7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17, + 1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27, + 1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37, + 1,0,0,0,1,39,1,0,0,0,1,41,1,0,0,0,2,43,1,0,0,0,2,45,1,0,0,0,2,47, + 1,0,0,0,3,49,1,0,0,0,4,51,1,0,0,0,5,53,1,0,0,0,7,58,1,0,0,0,9,65, + 1,0,0,0,11,71,1,0,0,0,13,75,1,0,0,0,15,80,1,0,0,0,17,85,1,0,0,0, + 19,90,1,0,0,0,21,97,1,0,0,0,23,101,1,0,0,0,25,107,1,0,0,0,27,111, + 1,0,0,0,29,116,1,0,0,0,31,118,1,0,0,0,33,120,1,0,0,0,35,126,1,0, + 0,0,37,131,1,0,0,0,39,141,1,0,0,0,41,148,1,0,0,0,43,153,1,0,0,0, + 45,158,1,0,0,0,47,164,1,0,0,0,49,170,1,0,0,0,51,178,1,0,0,0,53,54, + 5,84,0,0,54,55,5,65,0,0,55,56,5,82,0,0,56,57,5,71,0,0,57,6,1,0,0, + 0,58,59,5,70,0,0,59,60,5,73,0,0,60,61,5,76,0,0,61,62,5,69,0,0,62, + 63,1,0,0,0,63,64,6,1,0,0,64,8,1,0,0,0,65,66,5,65,0,0,66,67,5,66, + 0,0,67,68,5,83,0,0,68,69,1,0,0,0,69,70,6,2,1,0,70,10,1,0,0,0,71, + 72,5,76,0,0,72,73,5,79,0,0,73,74,5,67,0,0,74,12,1,0,0,0,75,76,5, + 78,0,0,76,77,5,84,0,0,77,78,5,82,0,0,78,79,5,89,0,0,79,14,1,0,0, + 0,80,81,5,78,0,0,81,82,5,65,0,0,82,83,5,77,0,0,83,84,5,69,0,0,84, + 16,1,0,0,0,85,86,5,65,0,0,86,87,5,76,0,0,87,88,5,73,0,0,88,89,5, + 71,0,0,89,18,1,0,0,0,90,91,5,68,0,0,91,92,5,65,0,0,92,93,5,84,0, + 0,93,94,5,65,0,0,94,95,1,0,0,0,95,96,6,7,2,0,96,20,1,0,0,0,97,98, + 5,82,0,0,98,99,5,69,0,0,99,100,5,76,0,0,100,22,1,0,0,0,101,102,5, + 88,0,0,102,103,5,84,0,0,103,104,5,82,0,0,104,105,5,78,0,0,105,24, + 1,0,0,0,106,108,7,0,0,0,107,106,1,0,0,0,108,109,1,0,0,0,109,107, + 1,0,0,0,109,110,1,0,0,0,110,26,1,0,0,0,111,112,5,36,0,0,112,113, + 5,97,0,0,113,114,5,98,0,0,114,115,5,115,0,0,115,28,1,0,0,0,116,117, + 5,58,0,0,117,30,1,0,0,0,118,119,5,45,0,0,119,32,1,0,0,0,120,121, + 5,43,0,0,121,34,1,0,0,0,122,124,5,13,0,0,123,122,1,0,0,0,123,124, + 1,0,0,0,124,125,1,0,0,0,125,127,5,10,0,0,126,123,1,0,0,0,127,128, + 1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,36,1,0,0,0,130,132,7, + 1,0,0,131,130,1,0,0,0,132,133,1,0,0,0,133,131,1,0,0,0,133,134,1, + 0,0,0,134,135,1,0,0,0,135,136,6,16,3,0,136,38,1,0,0,0,137,139,5, + 13,0,0,138,137,1,0,0,0,138,139,1,0,0,0,139,140,1,0,0,0,140,142,5, + 10,0,0,141,138,1,0,0,0,142,143,1,0,0,0,143,141,1,0,0,0,143,144,1, + 0,0,0,144,145,1,0,0,0,145,146,6,17,4,0,146,40,1,0,0,0,147,149,7, + 2,0,0,148,147,1,0,0,0,149,150,1,0,0,0,150,148,1,0,0,0,150,151,1, + 0,0,0,151,42,1,0,0,0,152,154,7,0,0,0,153,152,1,0,0,0,154,155,1,0, + 0,0,155,153,1,0,0,0,155,156,1,0,0,0,156,44,1,0,0,0,157,159,7,1,0, + 0,158,157,1,0,0,0,159,160,1,0,0,0,160,158,1,0,0,0,160,161,1,0,0, + 0,161,162,1,0,0,0,162,163,6,20,3,0,163,46,1,0,0,0,164,165,5,58,0, + 0,165,166,1,0,0,0,166,167,6,21,4,0,167,168,6,21,2,0,168,48,1,0,0, + 0,169,171,5,32,0,0,170,169,1,0,0,0,171,172,1,0,0,0,172,170,1,0,0, + 0,172,173,1,0,0,0,173,174,1,0,0,0,174,175,6,22,4,0,175,176,6,22, + 5,0,176,50,1,0,0,0,177,179,8,3,0,0,178,177,1,0,0,0,179,180,1,0,0, + 0,180,178,1,0,0,0,180,181,1,0,0,0,181,182,1,0,0,0,182,183,6,23,4, + 0,183,52,1,0,0,0,16,0,1,2,3,4,109,123,128,133,138,143,150,155,160, + 172,180,6,5,3,0,5,2,0,5,1,0,6,0,0,4,0,0,5,4,0 ] class ObjectFileLexer(Lexer): @@ -101,15 +102,16 @@ class ObjectFileLexer(Lexer): ABS_SECTION = 12 COLON = 13 MINUS = 14 - NEWLINE = 15 - WS = 16 - NEWLINE_BYTES = 17 - BYTES = 18 - WORD_ABS = 19 - WS_ABS = 20 - COLON_ABS = 21 - SPACES_FILE = 22 - FILEPATH = 23 + PLUS = 15 + NEWLINE = 16 + WS = 17 + NEWLINE_BYTES = 18 + BYTES = 19 + WORD_ABS = 20 + WS_ABS = 21 + COLON_ABS = 22 + SPACES_FILE = 23 + FILEPATH = 24 channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] @@ -117,18 +119,18 @@ class ObjectFileLexer(Lexer): literalNames = [ "", "'TARG'", "'FILE'", "'ABS'", "'LOC'", "'NTRY'", "'NAME'", "'ALIG'", - "'DATA'", "'REL'", "'XTRN'", "'$abs'", "'-'" ] + "'DATA'", "'REL'", "'XTRN'", "'$abs'", "'-'", "'+'" ] symbolicNames = [ "", "TARG", "FILE", "ABS", "LOC", "NTRY", "NAME", "ALIG", "DATA", - "REL", "XTRN", "WORD", "ABS_SECTION", "COLON", "MINUS", "NEWLINE", - "WS", "NEWLINE_BYTES", "BYTES", "WORD_ABS", "WS_ABS", "COLON_ABS", - "SPACES_FILE", "FILEPATH" ] + "REL", "XTRN", "WORD", "ABS_SECTION", "COLON", "MINUS", "PLUS", + "NEWLINE", "WS", "NEWLINE_BYTES", "BYTES", "WORD_ABS", "WS_ABS", + "COLON_ABS", "SPACES_FILE", "FILEPATH" ] ruleNames = [ "TARG", "FILE", "ABS", "LOC", "NTRY", "NAME", "ALIG", "DATA", "REL", "XTRN", "WORD", "ABS_SECTION", "COLON", - "MINUS", "NEWLINE", "WS", "NEWLINE_BYTES", "BYTES", "WORD_ABS", - "WS_ABS", "COLON_ABS", "SPACES_FILE", "FILEPATH" ] + "MINUS", "PLUS", "NEWLINE", "WS", "NEWLINE_BYTES", "BYTES", + "WORD_ABS", "WS_ABS", "COLON_ABS", "SPACES_FILE", "FILEPATH" ] grammarFileName = "ObjectFileLexer.g4" diff --git a/cocas/object_file/generated/ObjectFileParser.py b/cocas/object_file/generated/ObjectFileParser.py index 6cfca085..3f53d877 100644 --- a/cocas/object_file/generated/ObjectFileParser.py +++ b/cocas/object_file/generated/ObjectFileParser.py @@ -10,81 +10,87 @@ def serializedATN(): return [ - 4,1,23,225,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 4,1,24,242,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, 2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, - 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,1,0,3,0,52,8,0,1,0, - 3,0,55,8,0,1,0,4,0,58,8,0,11,0,12,0,59,1,0,1,0,1,1,3,1,65,8,1,1, - 1,1,1,5,1,69,8,1,10,1,12,1,72,9,1,1,1,4,1,75,8,1,11,1,12,1,76,3, - 1,79,8,1,1,1,5,1,82,8,1,10,1,12,1,85,9,1,1,2,1,2,4,2,89,8,2,11,2, - 12,2,90,1,3,1,3,5,3,95,8,3,10,3,12,3,98,9,3,1,4,1,4,3,4,102,8,4, - 1,4,1,4,5,4,106,8,4,10,4,12,4,109,9,4,1,4,3,4,112,8,4,1,4,5,4,115, - 8,4,10,4,12,4,118,9,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,7,1, - 7,1,7,1,7,3,7,133,8,7,1,7,4,7,136,8,7,11,7,12,7,137,1,8,1,8,5,8, - 142,8,8,10,8,12,8,145,9,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10, - 1,10,1,10,1,11,1,11,1,11,1,11,1,12,1,12,3,12,164,8,12,1,12,4,12, - 167,8,12,11,12,12,12,168,1,13,1,13,5,13,173,8,13,10,13,12,13,176, - 9,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,5,14,186,8,14,10,14, - 12,14,189,9,14,1,14,1,14,1,15,1,15,1,16,1,16,1,17,3,17,198,8,17, - 1,17,1,17,1,17,3,17,203,8,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19, - 1,19,1,19,1,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,24,1,24, - 1,24,0,0,25,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36, - 38,40,42,44,46,48,0,1,1,0,11,12,223,0,51,1,0,0,0,2,64,1,0,0,0,4, - 88,1,0,0,0,6,92,1,0,0,0,8,99,1,0,0,0,10,119,1,0,0,0,12,123,1,0,0, - 0,14,128,1,0,0,0,16,139,1,0,0,0,18,148,1,0,0,0,20,153,1,0,0,0,22, - 157,1,0,0,0,24,161,1,0,0,0,26,170,1,0,0,0,28,179,1,0,0,0,30,192, - 1,0,0,0,32,194,1,0,0,0,34,197,1,0,0,0,36,204,1,0,0,0,38,208,1,0, - 0,0,40,214,1,0,0,0,42,216,1,0,0,0,44,218,1,0,0,0,46,220,1,0,0,0, - 48,222,1,0,0,0,50,52,5,15,0,0,51,50,1,0,0,0,51,52,1,0,0,0,52,54, - 1,0,0,0,53,55,3,10,5,0,54,53,1,0,0,0,54,55,1,0,0,0,55,57,1,0,0,0, - 56,58,3,2,1,0,57,56,1,0,0,0,58,59,1,0,0,0,59,57,1,0,0,0,59,60,1, - 0,0,0,60,61,1,0,0,0,61,62,5,0,0,1,62,1,1,0,0,0,63,65,3,12,6,0,64, - 63,1,0,0,0,64,65,1,0,0,0,65,78,1,0,0,0,66,70,3,4,2,0,67,69,3,8,4, - 0,68,67,1,0,0,0,69,72,1,0,0,0,70,68,1,0,0,0,70,71,1,0,0,0,71,79, - 1,0,0,0,72,70,1,0,0,0,73,75,3,8,4,0,74,73,1,0,0,0,75,76,1,0,0,0, - 76,74,1,0,0,0,76,77,1,0,0,0,77,79,1,0,0,0,78,66,1,0,0,0,78,74,1, - 0,0,0,79,83,1,0,0,0,80,82,3,28,14,0,81,80,1,0,0,0,82,85,1,0,0,0, - 83,81,1,0,0,0,83,84,1,0,0,0,84,3,1,0,0,0,85,83,1,0,0,0,86,89,3,6, - 3,0,87,89,3,18,9,0,88,86,1,0,0,0,88,87,1,0,0,0,89,90,1,0,0,0,90, - 88,1,0,0,0,90,91,1,0,0,0,91,5,1,0,0,0,92,96,3,14,7,0,93,95,3,16, - 8,0,94,93,1,0,0,0,95,98,1,0,0,0,96,94,1,0,0,0,96,97,1,0,0,0,97,7, - 1,0,0,0,98,96,1,0,0,0,99,101,3,20,10,0,100,102,3,22,11,0,101,100, - 1,0,0,0,101,102,1,0,0,0,102,103,1,0,0,0,103,107,3,24,12,0,104,106, - 3,16,8,0,105,104,1,0,0,0,106,109,1,0,0,0,107,105,1,0,0,0,107,108, - 1,0,0,0,108,111,1,0,0,0,109,107,1,0,0,0,110,112,3,26,13,0,111,110, - 1,0,0,0,111,112,1,0,0,0,112,116,1,0,0,0,113,115,3,18,9,0,114,113, - 1,0,0,0,115,118,1,0,0,0,116,114,1,0,0,0,116,117,1,0,0,0,117,9,1, - 0,0,0,118,116,1,0,0,0,119,120,5,1,0,0,120,121,3,44,22,0,121,122, - 5,15,0,0,122,11,1,0,0,0,123,124,5,2,0,0,124,125,5,22,0,0,125,126, - 3,32,16,0,126,127,5,15,0,0,127,13,1,0,0,0,128,129,5,3,0,0,129,130, - 3,40,20,0,130,132,5,21,0,0,131,133,3,30,15,0,132,131,1,0,0,0,132, - 133,1,0,0,0,133,135,1,0,0,0,134,136,5,17,0,0,135,134,1,0,0,0,136, - 137,1,0,0,0,137,135,1,0,0,0,137,138,1,0,0,0,138,15,1,0,0,0,139,143, - 5,4,0,0,140,142,3,38,19,0,141,140,1,0,0,0,142,145,1,0,0,0,143,141, - 1,0,0,0,143,144,1,0,0,0,144,146,1,0,0,0,145,143,1,0,0,0,146,147, - 5,15,0,0,147,17,1,0,0,0,148,149,5,5,0,0,149,150,3,44,22,0,150,151, - 3,42,21,0,151,152,5,15,0,0,152,19,1,0,0,0,153,154,5,6,0,0,154,155, - 3,46,23,0,155,156,5,15,0,0,156,21,1,0,0,0,157,158,5,7,0,0,158,159, - 3,42,21,0,159,160,5,15,0,0,160,23,1,0,0,0,161,163,5,8,0,0,162,164, - 3,30,15,0,163,162,1,0,0,0,163,164,1,0,0,0,164,166,1,0,0,0,165,167, - 5,17,0,0,166,165,1,0,0,0,167,168,1,0,0,0,168,166,1,0,0,0,168,169, - 1,0,0,0,169,25,1,0,0,0,170,174,5,9,0,0,171,173,3,34,17,0,172,171, - 1,0,0,0,173,176,1,0,0,0,174,172,1,0,0,0,174,175,1,0,0,0,175,177, - 1,0,0,0,176,174,1,0,0,0,177,178,5,15,0,0,178,27,1,0,0,0,179,180, - 5,10,0,0,180,181,3,44,22,0,181,187,5,13,0,0,182,183,3,46,23,0,183, - 184,3,34,17,0,184,186,1,0,0,0,185,182,1,0,0,0,186,189,1,0,0,0,187, - 185,1,0,0,0,187,188,1,0,0,0,188,190,1,0,0,0,189,187,1,0,0,0,190, - 191,5,15,0,0,191,29,1,0,0,0,192,193,5,18,0,0,193,31,1,0,0,0,194, - 195,5,23,0,0,195,33,1,0,0,0,196,198,3,48,24,0,197,196,1,0,0,0,197, - 198,1,0,0,0,198,199,1,0,0,0,199,202,3,42,21,0,200,201,5,13,0,0,201, - 203,3,36,18,0,202,200,1,0,0,0,202,203,1,0,0,0,203,35,1,0,0,0,204, - 205,3,42,21,0,205,206,5,13,0,0,206,207,3,42,21,0,207,37,1,0,0,0, - 208,209,3,42,21,0,209,210,5,13,0,0,210,211,3,42,21,0,211,212,5,13, - 0,0,212,213,3,42,21,0,213,39,1,0,0,0,214,215,5,19,0,0,215,41,1,0, - 0,0,216,217,5,11,0,0,217,43,1,0,0,0,218,219,5,11,0,0,219,45,1,0, - 0,0,220,221,7,0,0,0,221,47,1,0,0,0,222,223,5,14,0,0,223,49,1,0,0, - 0,24,51,54,59,64,70,76,78,83,88,90,96,101,107,111,116,132,137,143, - 163,168,174,187,197,202 + 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26, + 1,0,3,0,56,8,0,1,0,3,0,59,8,0,1,0,4,0,62,8,0,11,0,12,0,63,1,0,1, + 0,1,1,3,1,69,8,1,1,1,1,1,5,1,73,8,1,10,1,12,1,76,9,1,1,1,4,1,79, + 8,1,11,1,12,1,80,3,1,83,8,1,1,1,5,1,86,8,1,10,1,12,1,89,9,1,1,2, + 1,2,4,2,93,8,2,11,2,12,2,94,1,3,1,3,5,3,99,8,3,10,3,12,3,102,9,3, + 1,4,1,4,3,4,106,8,4,1,4,1,4,5,4,110,8,4,10,4,12,4,113,9,4,1,4,3, + 4,116,8,4,1,4,5,4,119,8,4,10,4,12,4,122,9,4,1,5,1,5,1,5,1,5,1,6, + 1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,3,7,137,8,7,1,7,4,7,140,8,7,11,7, + 12,7,141,1,8,1,8,5,8,146,8,8,10,8,12,8,149,9,8,1,8,1,8,1,9,1,9,1, + 9,1,9,1,9,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,12,1,12,3,12, + 168,8,12,1,12,4,12,171,8,12,11,12,12,12,172,1,13,1,13,5,13,177,8, + 13,10,13,12,13,180,9,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14, + 5,14,190,8,14,10,14,12,14,193,9,14,1,14,1,14,1,15,1,15,1,16,1,16, + 1,17,3,17,202,8,17,1,17,1,17,1,17,1,17,3,17,208,8,17,3,17,210,8, + 17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,3,19,222,8, + 19,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1, + 24,1,24,1,25,1,25,1,26,1,26,1,26,0,0,27,0,2,4,6,8,10,12,14,16,18, + 20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,0,1,1,0,11,12, + 240,0,55,1,0,0,0,2,68,1,0,0,0,4,92,1,0,0,0,6,96,1,0,0,0,8,103,1, + 0,0,0,10,123,1,0,0,0,12,127,1,0,0,0,14,132,1,0,0,0,16,143,1,0,0, + 0,18,152,1,0,0,0,20,157,1,0,0,0,22,161,1,0,0,0,24,165,1,0,0,0,26, + 174,1,0,0,0,28,183,1,0,0,0,30,196,1,0,0,0,32,198,1,0,0,0,34,201, + 1,0,0,0,36,211,1,0,0,0,38,221,1,0,0,0,40,223,1,0,0,0,42,229,1,0, + 0,0,44,231,1,0,0,0,46,233,1,0,0,0,48,235,1,0,0,0,50,237,1,0,0,0, + 52,239,1,0,0,0,54,56,5,16,0,0,55,54,1,0,0,0,55,56,1,0,0,0,56,58, + 1,0,0,0,57,59,3,10,5,0,58,57,1,0,0,0,58,59,1,0,0,0,59,61,1,0,0,0, + 60,62,3,2,1,0,61,60,1,0,0,0,62,63,1,0,0,0,63,61,1,0,0,0,63,64,1, + 0,0,0,64,65,1,0,0,0,65,66,5,0,0,1,66,1,1,0,0,0,67,69,3,12,6,0,68, + 67,1,0,0,0,68,69,1,0,0,0,69,82,1,0,0,0,70,74,3,4,2,0,71,73,3,8,4, + 0,72,71,1,0,0,0,73,76,1,0,0,0,74,72,1,0,0,0,74,75,1,0,0,0,75,83, + 1,0,0,0,76,74,1,0,0,0,77,79,3,8,4,0,78,77,1,0,0,0,79,80,1,0,0,0, + 80,78,1,0,0,0,80,81,1,0,0,0,81,83,1,0,0,0,82,70,1,0,0,0,82,78,1, + 0,0,0,83,87,1,0,0,0,84,86,3,28,14,0,85,84,1,0,0,0,86,89,1,0,0,0, + 87,85,1,0,0,0,87,88,1,0,0,0,88,3,1,0,0,0,89,87,1,0,0,0,90,93,3,6, + 3,0,91,93,3,18,9,0,92,90,1,0,0,0,92,91,1,0,0,0,93,94,1,0,0,0,94, + 92,1,0,0,0,94,95,1,0,0,0,95,5,1,0,0,0,96,100,3,14,7,0,97,99,3,16, + 8,0,98,97,1,0,0,0,99,102,1,0,0,0,100,98,1,0,0,0,100,101,1,0,0,0, + 101,7,1,0,0,0,102,100,1,0,0,0,103,105,3,20,10,0,104,106,3,22,11, + 0,105,104,1,0,0,0,105,106,1,0,0,0,106,107,1,0,0,0,107,111,3,24,12, + 0,108,110,3,16,8,0,109,108,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0, + 0,111,112,1,0,0,0,112,115,1,0,0,0,113,111,1,0,0,0,114,116,3,26,13, + 0,115,114,1,0,0,0,115,116,1,0,0,0,116,120,1,0,0,0,117,119,3,18,9, + 0,118,117,1,0,0,0,119,122,1,0,0,0,120,118,1,0,0,0,120,121,1,0,0, + 0,121,9,1,0,0,0,122,120,1,0,0,0,123,124,5,1,0,0,124,125,3,46,23, + 0,125,126,5,16,0,0,126,11,1,0,0,0,127,128,5,2,0,0,128,129,5,23,0, + 0,129,130,3,32,16,0,130,131,5,16,0,0,131,13,1,0,0,0,132,133,5,3, + 0,0,133,134,3,42,21,0,134,136,5,22,0,0,135,137,3,30,15,0,136,135, + 1,0,0,0,136,137,1,0,0,0,137,139,1,0,0,0,138,140,5,18,0,0,139,138, + 1,0,0,0,140,141,1,0,0,0,141,139,1,0,0,0,141,142,1,0,0,0,142,15,1, + 0,0,0,143,147,5,4,0,0,144,146,3,40,20,0,145,144,1,0,0,0,146,149, + 1,0,0,0,147,145,1,0,0,0,147,148,1,0,0,0,148,150,1,0,0,0,149,147, + 1,0,0,0,150,151,5,16,0,0,151,17,1,0,0,0,152,153,5,5,0,0,153,154, + 3,46,23,0,154,155,3,44,22,0,155,156,5,16,0,0,156,19,1,0,0,0,157, + 158,5,6,0,0,158,159,3,48,24,0,159,160,5,16,0,0,160,21,1,0,0,0,161, + 162,5,7,0,0,162,163,3,44,22,0,163,164,5,16,0,0,164,23,1,0,0,0,165, + 167,5,8,0,0,166,168,3,30,15,0,167,166,1,0,0,0,167,168,1,0,0,0,168, + 170,1,0,0,0,169,171,5,18,0,0,170,169,1,0,0,0,171,172,1,0,0,0,172, + 170,1,0,0,0,172,173,1,0,0,0,173,25,1,0,0,0,174,178,5,9,0,0,175,177, + 3,34,17,0,176,175,1,0,0,0,177,180,1,0,0,0,178,176,1,0,0,0,178,179, + 1,0,0,0,179,181,1,0,0,0,180,178,1,0,0,0,181,182,5,16,0,0,182,27, + 1,0,0,0,183,184,5,10,0,0,184,185,3,46,23,0,185,191,5,13,0,0,186, + 187,3,48,24,0,187,188,3,34,17,0,188,190,1,0,0,0,189,186,1,0,0,0, + 190,193,1,0,0,0,191,189,1,0,0,0,191,192,1,0,0,0,192,194,1,0,0,0, + 193,191,1,0,0,0,194,195,5,16,0,0,195,29,1,0,0,0,196,197,5,19,0,0, + 197,31,1,0,0,0,198,199,5,24,0,0,199,33,1,0,0,0,200,202,3,50,25,0, + 201,200,1,0,0,0,201,202,1,0,0,0,202,203,1,0,0,0,203,209,3,44,22, + 0,204,205,5,13,0,0,205,207,3,36,18,0,206,208,3,38,19,0,207,206,1, + 0,0,0,207,208,1,0,0,0,208,210,1,0,0,0,209,204,1,0,0,0,209,210,1, + 0,0,0,210,35,1,0,0,0,211,212,3,44,22,0,212,213,5,13,0,0,213,214, + 3,44,22,0,214,37,1,0,0,0,215,216,3,52,26,0,216,217,3,44,22,0,217, + 222,1,0,0,0,218,219,3,50,25,0,219,220,3,44,22,0,220,222,1,0,0,0, + 221,215,1,0,0,0,221,218,1,0,0,0,222,39,1,0,0,0,223,224,3,44,22,0, + 224,225,5,13,0,0,225,226,3,44,22,0,226,227,5,13,0,0,227,228,3,44, + 22,0,228,41,1,0,0,0,229,230,5,20,0,0,230,43,1,0,0,0,231,232,5,11, + 0,0,232,45,1,0,0,0,233,234,5,11,0,0,234,47,1,0,0,0,235,236,7,0,0, + 0,236,49,1,0,0,0,237,238,5,14,0,0,238,51,1,0,0,0,239,240,5,15,0, + 0,240,53,1,0,0,0,26,55,58,63,68,74,80,82,87,92,94,100,105,111,115, + 120,136,141,147,167,172,178,191,201,207,209,221 ] class ObjectFileParser ( Parser ): @@ -99,11 +105,11 @@ class ObjectFileParser ( Parser ): literalNames = [ "", "'TARG'", "'FILE'", "'ABS'", "'LOC'", "'NTRY'", "'NAME'", "'ALIG'", "'DATA'", "'REL'", "'XTRN'", - "", "'$abs'", "", "'-'" ] + "", "'$abs'", "", "'-'", "'+'" ] symbolicNames = [ "", "TARG", "FILE", "ABS", "LOC", "NTRY", "NAME", "ALIG", "DATA", "REL", "XTRN", "WORD", "ABS_SECTION", - "COLON", "MINUS", "NEWLINE", "WS", "NEWLINE_BYTES", + "COLON", "MINUS", "PLUS", "NEWLINE", "WS", "NEWLINE_BYTES", "BYTES", "WORD_ABS", "WS_ABS", "COLON_ABS", "SPACES_FILE", "FILEPATH" ] @@ -126,19 +132,21 @@ class ObjectFileParser ( Parser ): RULE_filepath = 16 RULE_entry_usage = 17 RULE_range = 18 - RULE_location = 19 - RULE_abs_address = 20 - RULE_number = 21 - RULE_label = 22 - RULE_section = 23 - RULE_minus = 24 + RULE_lower_part = 19 + RULE_location = 20 + RULE_abs_address = 21 + RULE_number = 22 + RULE_label = 23 + RULE_section = 24 + RULE_minus = 25 + RULE_plus = 26 ruleNames = [ "object_file", "object_block", "asect_block", "abs_block", "rsect_block", "targ_record", "source_record", "abs_record", "loc_record", "ntry_record", "name_record", "alig_record", "data_record", "rel_record", "xtrn_record", "data", "filepath", - "entry_usage", "range", "location", "abs_address", "number", - "label", "section", "minus" ] + "entry_usage", "range", "lower_part", "location", "abs_address", + "number", "label", "section", "minus", "plus" ] EOF = Token.EOF TARG=1 @@ -155,15 +163,16 @@ class ObjectFileParser ( Parser ): ABS_SECTION=12 COLON=13 MINUS=14 - NEWLINE=15 - WS=16 - NEWLINE_BYTES=17 - BYTES=18 - WORD_ABS=19 - WS_ABS=20 - COLON_ABS=21 - SPACES_FILE=22 - FILEPATH=23 + PLUS=15 + NEWLINE=16 + WS=17 + NEWLINE_BYTES=18 + BYTES=19 + WORD_ABS=20 + WS_ABS=21 + COLON_ABS=22 + SPACES_FILE=23 + FILEPATH=24 def __init__(self, input:TokenStream, output:TextIO = sys.stdout): super().__init__(input, output) @@ -217,35 +226,35 @@ def object_file(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 51 + self.state = 55 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==15: - self.state = 50 + if _la==16: + self.state = 54 self.match(ObjectFileParser.NEWLINE) - self.state = 54 + self.state = 58 self._errHandler.sync(self) _la = self._input.LA(1) if _la==1: - self.state = 53 + self.state = 57 self.targ_record() - self.state = 57 + self.state = 61 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 56 + self.state = 60 self.object_block() - self.state = 59 + self.state = 63 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 108) != 0)): break - self.state = 61 + self.state = 65 self.match(ObjectFileParser.EOF) except RecognitionException as re: localctx.exception = re @@ -304,44 +313,44 @@ def object_block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 64 + self.state = 68 self._errHandler.sync(self) _la = self._input.LA(1) if _la==2: - self.state = 63 + self.state = 67 self.source_record() - self.state = 78 + self.state = 82 self._errHandler.sync(self) token = self._input.LA(1) if token in [3, 5]: - self.state = 66 - self.asect_block() self.state = 70 + self.asect_block() + self.state = 74 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,4,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 67 + self.state = 71 self.rsect_block() - self.state = 72 + self.state = 76 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,4,self._ctx) pass elif token in [6]: - self.state = 74 + self.state = 78 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 73 + self.state = 77 self.rsect_block() else: raise NoViableAltException(self) - self.state = 76 + self.state = 80 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) @@ -349,13 +358,13 @@ def object_block(self): else: raise NoViableAltException(self) - self.state = 83 + self.state = 87 self._errHandler.sync(self) _la = self._input.LA(1) while _la==10: - self.state = 80 + self.state = 84 self.xtrn_record() - self.state = 85 + self.state = 89 self._errHandler.sync(self) _la = self._input.LA(1) @@ -407,20 +416,20 @@ def asect_block(self): self.enterRule(localctx, 4, self.RULE_asect_block) try: self.enterOuterAlt(localctx, 1) - self.state = 88 + self.state = 92 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 88 + self.state = 92 self._errHandler.sync(self) token = self._input.LA(1) if token in [3]: - self.state = 86 + self.state = 90 self.abs_block() pass elif token in [5]: - self.state = 87 + self.state = 91 self.ntry_record() pass else: @@ -429,7 +438,7 @@ def asect_block(self): else: raise NoViableAltException(self) - self.state = 90 + self.state = 94 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,9,self._ctx) @@ -479,15 +488,15 @@ def abs_block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 92 - self.abs_record() self.state = 96 + self.abs_record() + self.state = 100 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 93 + self.state = 97 self.loc_record() - self.state = 98 + self.state = 102 self._errHandler.sync(self) _la = self._input.LA(1) @@ -556,44 +565,44 @@ def rsect_block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 99 + self.state = 103 self.name_record() - self.state = 101 + self.state = 105 self._errHandler.sync(self) _la = self._input.LA(1) if _la==7: - self.state = 100 + self.state = 104 self.alig_record() - self.state = 103 - self.data_record() self.state = 107 + self.data_record() + self.state = 111 self._errHandler.sync(self) _la = self._input.LA(1) while _la==4: - self.state = 104 + self.state = 108 self.loc_record() - self.state = 109 + self.state = 113 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 111 + self.state = 115 self._errHandler.sync(self) _la = self._input.LA(1) if _la==9: - self.state = 110 + self.state = 114 self.rel_record() - self.state = 116 + self.state = 120 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,14,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 113 + self.state = 117 self.ntry_record() - self.state = 118 + self.state = 122 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,14,self._ctx) @@ -641,11 +650,11 @@ def targ_record(self): self.enterRule(localctx, 10, self.RULE_targ_record) try: self.enterOuterAlt(localctx, 1) - self.state = 119 + self.state = 123 self.match(ObjectFileParser.TARG) - self.state = 120 + self.state = 124 self.label() - self.state = 121 + self.state = 125 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -694,13 +703,13 @@ def source_record(self): self.enterRule(localctx, 12, self.RULE_source_record) try: self.enterOuterAlt(localctx, 1) - self.state = 123 + self.state = 127 self.match(ObjectFileParser.FILE) - self.state = 124 + self.state = 128 self.match(ObjectFileParser.SPACES_FILE) - self.state = 125 + self.state = 129 self.filepath() - self.state = 126 + self.state = 130 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -757,30 +766,30 @@ def abs_record(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 128 + self.state = 132 self.match(ObjectFileParser.ABS) - self.state = 129 + self.state = 133 self.abs_address() - self.state = 130 + self.state = 134 self.match(ObjectFileParser.COLON_ABS) - self.state = 132 + self.state = 136 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==18: - self.state = 131 + if _la==19: + self.state = 135 self.data() - self.state = 135 + self.state = 139 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 134 + self.state = 138 self.match(ObjectFileParser.NEWLINE_BYTES) - self.state = 137 + self.state = 141 self._errHandler.sync(self) _la = self._input.LA(1) - if not (_la==17): + if not (_la==18): break except RecognitionException as re: @@ -831,19 +840,19 @@ def loc_record(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 139 - self.match(ObjectFileParser.LOC) self.state = 143 + self.match(ObjectFileParser.LOC) + self.state = 147 self._errHandler.sync(self) _la = self._input.LA(1) while _la==11: - self.state = 140 + self.state = 144 self.location() - self.state = 145 + self.state = 149 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 146 + self.state = 150 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -893,13 +902,13 @@ def ntry_record(self): self.enterRule(localctx, 18, self.RULE_ntry_record) try: self.enterOuterAlt(localctx, 1) - self.state = 148 + self.state = 152 self.match(ObjectFileParser.NTRY) - self.state = 149 + self.state = 153 self.label() - self.state = 150 + self.state = 154 self.number() - self.state = 151 + self.state = 155 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -945,11 +954,11 @@ def name_record(self): self.enterRule(localctx, 20, self.RULE_name_record) try: self.enterOuterAlt(localctx, 1) - self.state = 153 + self.state = 157 self.match(ObjectFileParser.NAME) - self.state = 154 + self.state = 158 self.section() - self.state = 155 + self.state = 159 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -995,11 +1004,11 @@ def alig_record(self): self.enterRule(localctx, 22, self.RULE_alig_record) try: self.enterOuterAlt(localctx, 1) - self.state = 157 + self.state = 161 self.match(ObjectFileParser.ALIG) - self.state = 158 + self.state = 162 self.number() - self.state = 159 + self.state = 163 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -1049,26 +1058,26 @@ def data_record(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 161 + self.state = 165 self.match(ObjectFileParser.DATA) - self.state = 163 + self.state = 167 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==18: - self.state = 162 + if _la==19: + self.state = 166 self.data() - self.state = 166 + self.state = 170 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 165 + self.state = 169 self.match(ObjectFileParser.NEWLINE_BYTES) - self.state = 168 + self.state = 172 self._errHandler.sync(self) _la = self._input.LA(1) - if not (_la==17): + if not (_la==18): break except RecognitionException as re: @@ -1119,19 +1128,19 @@ def rel_record(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 170 - self.match(ObjectFileParser.REL) self.state = 174 + self.match(ObjectFileParser.REL) + self.state = 178 self._errHandler.sync(self) _la = self._input.LA(1) while _la==11 or _la==14: - self.state = 171 + self.state = 175 self.entry_usage() - self.state = 176 + self.state = 180 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 177 + self.state = 181 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -1195,25 +1204,25 @@ def xtrn_record(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 179 + self.state = 183 self.match(ObjectFileParser.XTRN) - self.state = 180 + self.state = 184 self.label() - self.state = 181 + self.state = 185 self.match(ObjectFileParser.COLON) - self.state = 187 + self.state = 191 self._errHandler.sync(self) _la = self._input.LA(1) while _la==11 or _la==12: - self.state = 182 + self.state = 186 self.section() - self.state = 183 + self.state = 187 self.entry_usage() - self.state = 189 + self.state = 193 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 190 + self.state = 194 self.match(ObjectFileParser.NEWLINE) except RecognitionException as re: localctx.exception = re @@ -1252,7 +1261,7 @@ def data(self): self.enterRule(localctx, 30, self.RULE_data) try: self.enterOuterAlt(localctx, 1) - self.state = 192 + self.state = 196 self.match(ObjectFileParser.BYTES) except RecognitionException as re: localctx.exception = re @@ -1291,7 +1300,7 @@ def filepath(self): self.enterRule(localctx, 32, self.RULE_filepath) try: self.enterOuterAlt(localctx, 1) - self.state = 194 + self.state = 198 self.match(ObjectFileParser.FILEPATH) except RecognitionException as re: localctx.exception = re @@ -1324,6 +1333,10 @@ def range_(self): return self.getTypedRuleContext(ObjectFileParser.RangeContext,0) + def lower_part(self): + return self.getTypedRuleContext(ObjectFileParser.Lower_partContext,0) + + def getRuleIndex(self): return ObjectFileParser.RULE_entry_usage @@ -1343,24 +1356,32 @@ def entry_usage(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 197 + self.state = 201 self._errHandler.sync(self) _la = self._input.LA(1) if _la==14: - self.state = 196 + self.state = 200 self.minus() - self.state = 199 + self.state = 203 self.number() - self.state = 202 + self.state = 209 self._errHandler.sync(self) _la = self._input.LA(1) if _la==13: - self.state = 200 + self.state = 204 self.match(ObjectFileParser.COLON) - self.state = 201 + self.state = 205 self.range_() + self.state = 207 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,23,self._ctx) + if la_ == 1: + self.state = 206 + self.lower_part() + + except RecognitionException as re: @@ -1407,11 +1428,11 @@ def range_(self): self.enterRule(localctx, 36, self.RULE_range) try: self.enterOuterAlt(localctx, 1) - self.state = 204 + self.state = 211 self.number() - self.state = 205 + self.state = 212 self.match(ObjectFileParser.COLON) - self.state = 206 + self.state = 213 self.number() except RecognitionException as re: localctx.exception = re @@ -1422,6 +1443,71 @@ def range_(self): return localctx + class Lower_partContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def plus(self): + return self.getTypedRuleContext(ObjectFileParser.PlusContext,0) + + + def number(self): + return self.getTypedRuleContext(ObjectFileParser.NumberContext,0) + + + def minus(self): + return self.getTypedRuleContext(ObjectFileParser.MinusContext,0) + + + def getRuleIndex(self): + return ObjectFileParser.RULE_lower_part + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitLower_part" ): + return visitor.visitLower_part(self) + else: + return visitor.visitChildren(self) + + + + + def lower_part(self): + + localctx = ObjectFileParser.Lower_partContext(self, self._ctx, self.state) + self.enterRule(localctx, 38, self.RULE_lower_part) + try: + self.state = 221 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.enterOuterAlt(localctx, 1) + self.state = 215 + self.plus() + self.state = 216 + self.number() + pass + elif token in [14]: + self.enterOuterAlt(localctx, 2) + self.state = 218 + self.minus() + self.state = 219 + self.number() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + class LocationContext(ParserRuleContext): __slots__ = 'parser' @@ -1457,18 +1543,18 @@ def accept(self, visitor:ParseTreeVisitor): def location(self): localctx = ObjectFileParser.LocationContext(self, self._ctx, self.state) - self.enterRule(localctx, 38, self.RULE_location) + self.enterRule(localctx, 40, self.RULE_location) try: self.enterOuterAlt(localctx, 1) - self.state = 208 + self.state = 223 self.number() - self.state = 209 + self.state = 224 self.match(ObjectFileParser.COLON) - self.state = 210 + self.state = 225 self.number() - self.state = 211 + self.state = 226 self.match(ObjectFileParser.COLON) - self.state = 212 + self.state = 227 self.number() except RecognitionException as re: localctx.exception = re @@ -1504,10 +1590,10 @@ def accept(self, visitor:ParseTreeVisitor): def abs_address(self): localctx = ObjectFileParser.Abs_addressContext(self, self._ctx, self.state) - self.enterRule(localctx, 40, self.RULE_abs_address) + self.enterRule(localctx, 42, self.RULE_abs_address) try: self.enterOuterAlt(localctx, 1) - self.state = 214 + self.state = 229 self.match(ObjectFileParser.WORD_ABS) except RecognitionException as re: localctx.exception = re @@ -1543,10 +1629,10 @@ def accept(self, visitor:ParseTreeVisitor): def number(self): localctx = ObjectFileParser.NumberContext(self, self._ctx, self.state) - self.enterRule(localctx, 42, self.RULE_number) + self.enterRule(localctx, 44, self.RULE_number) try: self.enterOuterAlt(localctx, 1) - self.state = 216 + self.state = 231 self.match(ObjectFileParser.WORD) except RecognitionException as re: localctx.exception = re @@ -1582,10 +1668,10 @@ def accept(self, visitor:ParseTreeVisitor): def label(self): localctx = ObjectFileParser.LabelContext(self, self._ctx, self.state) - self.enterRule(localctx, 44, self.RULE_label) + self.enterRule(localctx, 46, self.RULE_label) try: self.enterOuterAlt(localctx, 1) - self.state = 218 + self.state = 233 self.match(ObjectFileParser.WORD) except RecognitionException as re: localctx.exception = re @@ -1624,11 +1710,11 @@ def accept(self, visitor:ParseTreeVisitor): def section(self): localctx = ObjectFileParser.SectionContext(self, self._ctx, self.state) - self.enterRule(localctx, 46, self.RULE_section) + self.enterRule(localctx, 48, self.RULE_section) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 220 + self.state = 235 _la = self._input.LA(1) if not(_la==11 or _la==12): self._errHandler.recoverInline(self) @@ -1669,10 +1755,10 @@ def accept(self, visitor:ParseTreeVisitor): def minus(self): localctx = ObjectFileParser.MinusContext(self, self._ctx, self.state) - self.enterRule(localctx, 48, self.RULE_minus) + self.enterRule(localctx, 50, self.RULE_minus) try: self.enterOuterAlt(localctx, 1) - self.state = 222 + self.state = 237 self.match(ObjectFileParser.MINUS) except RecognitionException as re: localctx.exception = re @@ -1683,6 +1769,45 @@ def minus(self): return localctx + class PlusContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def PLUS(self): + return self.getToken(ObjectFileParser.PLUS, 0) + + def getRuleIndex(self): + return ObjectFileParser.RULE_plus + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPlus" ): + return visitor.visitPlus(self) + else: + return visitor.visitChildren(self) + + + + + def plus(self): + + localctx = ObjectFileParser.PlusContext(self, self._ctx, self.state) + self.enterRule(localctx, 52, self.RULE_plus) + try: + self.enterOuterAlt(localctx, 1) + self.state = 239 + self.match(ObjectFileParser.PLUS) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + diff --git a/cocas/object_file/generated/ObjectFileParserVisitor.py b/cocas/object_file/generated/ObjectFileParserVisitor.py index 698be135..a9cbb7c9 100644 --- a/cocas/object_file/generated/ObjectFileParserVisitor.py +++ b/cocas/object_file/generated/ObjectFileParserVisitor.py @@ -104,6 +104,11 @@ def visitRange(self, ctx:ObjectFileParser.RangeContext): return self.visitChildren(ctx) + # Visit a parse tree produced by ObjectFileParser#lower_part. + def visitLower_part(self, ctx:ObjectFileParser.Lower_partContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by ObjectFileParser#location. def visitLocation(self, ctx:ObjectFileParser.LocationContext): return self.visitChildren(ctx) @@ -134,5 +139,10 @@ def visitMinus(self, ctx:ObjectFileParser.MinusContext): return self.visitChildren(ctx) + # Visit a parse tree produced by ObjectFileParser#plus. + def visitPlus(self, ctx:ObjectFileParser.PlusContext): + return self.visitChildren(ctx) + + del ObjectFileParser \ No newline at end of file diff --git a/cocas/object_file/grammar/ObjectFileLexer.g4 b/cocas/object_file/grammar/ObjectFileLexer.g4 index 59fa0a73..2339f971 100644 --- a/cocas/object_file/grammar/ObjectFileLexer.g4 +++ b/cocas/object_file/grammar/ObjectFileLexer.g4 @@ -16,6 +16,7 @@ ABS_SECTION: '$abs'; COLON: ':'; MINUS: '-'; +PLUS: '+'; NEWLINE: ('\r'? '\n')+ ; WS : (' ' | '\t')+ -> skip ; diff --git a/cocas/object_file/grammar/ObjectFileParser.g4 b/cocas/object_file/grammar/ObjectFileParser.g4 index ebe14386..c46498fe 100644 --- a/cocas/object_file/grammar/ObjectFileParser.g4 +++ b/cocas/object_file/grammar/ObjectFileParser.g4 @@ -49,8 +49,9 @@ xtrn_record: XTRN label COLON (section entry_usage)* NEWLINE; data: BYTES; filepath: FILEPATH; -entry_usage: minus? number (COLON range)?; +entry_usage: minus? number (COLON range lower_part?)?; range: number COLON number; +lower_part: PLUS number; location: number COLON number COLON number; abs_address: WORD_ABS; diff --git a/cocas/object_file/object_import.py b/cocas/object_file/object_import.py index 08571321..3343161e 100644 --- a/cocas/object_file/object_import.py +++ b/cocas/object_file/object_import.py @@ -194,7 +194,11 @@ def visitEntry_usage(self, ctx: ObjectFileParser.Entry_usageContext): addr = self.visitNumber(ctx.number()) sign = -1 if ctx.minus() else 1 if ctx.range_(): - return ExternalEntry(addr, self.visitRange(ctx.range_()), sign, False) + range_ = self.visitRange(ctx.range_()) + if ctx.lower_part(): + return ExternalEntry(addr, range_, sign, False, lower_part=self.visitLower_part(ctx.lower_part())) + else: + return ExternalEntry(addr, range_, sign, False) else: entry_size = self.target_params.max_entry_size return ExternalEntry(addr, range(0, entry_size), sign, True) diff --git a/cocas/object_module/external_entry.py b/cocas/object_module/external_entry.py index 04a414ef..818a32db 100644 --- a/cocas/object_module/external_entry.py +++ b/cocas/object_module/external_entry.py @@ -21,7 +21,9 @@ class ExternalEntry: def __str__(self): s = f'{self.sign * self.offset:02x}' if not self.full_bytes: - s += f':{self.entry_bytes.start}:{self.entry_bytes.stop}' + s += f':{self.entry_bytes.start:x}:{self.entry_bytes.stop:x}' + if self.lower_part: + s += f'+{self.lower_part:x}' return s def __repr__(self):