@@ -122,12 +122,18 @@ type linkerInfo = Map<
122122 file : string ;
123123 }
124124> ;
125- type macro = {
126- name : string ;
127- args : string [ ] ;
128- lines : parsedPart [ ] [ ] ;
129- line : number ;
130- } ;
125+ type macro =
126+ | {
127+ name : string ;
128+ args : string [ ] ;
129+ lines : parsedPart [ ] [ ] ;
130+ line : number ;
131+ }
132+ | {
133+ name : string ;
134+ parts : parsedPart [ ] ;
135+ line : number ;
136+ } ;
131137type labelMap = Map < string , number > ;
132138function assemble ( files : [ string , string ] [ ] ) {
133139 const textView = new DataView ( new ArrayBuffer ( 1 << 22 ) ) ;
@@ -376,7 +382,7 @@ function assemble(files: [string, string][]) {
376382 for ( const line of basicParsing ) {
377383 let s = 0 ;
378384 const lineArr = [ ...line ] ;
379- if ( macroBuild ) {
385+ if ( macroBuild && "lines" in macroBuild ) {
380386 if (
381387 lineArr . length === 1 &&
382388 lineArr [ 0 ] . type == "directive" &&
@@ -459,6 +465,24 @@ function assemble(files: [string, string][]) {
459465 line : i + 1 ,
460466 } ;
461467 break ;
468+ case "eqv" : {
469+ const name = getNextSymbol ( ) ;
470+ if ( ! name || name . type !== "unknown" ) {
471+ throw new AssemblError ( I18n . errors . eqvName ( i + 1 + "" , data . content ) , i , file ) ;
472+ }
473+ const parts : parsedPart [ ] = lineArr ;
474+ parts . shift ( ) ;
475+ parts . shift ( ) ;
476+ parts . shift ( ) ;
477+
478+ macros . set ( name . content , {
479+ name : name . content ,
480+ line : i + 1 ,
481+ parts,
482+ } ) ;
483+ s = Infinity ;
484+ break ;
485+ }
462486 default :
463487 throw new AssemblError (
464488 I18n . errors . unknownDirective ( i + 1 + "" , data . content ) ,
@@ -544,9 +568,10 @@ function assemble(files: [string, string][]) {
544568 } else if ( symbol . type === "label" ) {
545569 const arr = [ ...symbol . content ] ;
546570 arr . pop ( ) ;
571+ const name = arr . join ( "" ) ;
547572 return {
548573 type : "label" ,
549- content : arr . join ( "" ) ,
574+ content : name ,
550575 } ;
551576 } else if ( symbol . type === "directive" ) {
552577 const arr = [ ...symbol . content ] ;
@@ -576,6 +601,14 @@ function assemble(files: [string, string][]) {
576601 type : "variable" ,
577602 content,
578603 } ;
604+ } else if ( symbol . type === "unknown" ) {
605+ const m = macros . get ( symbol . content ) ;
606+ if ( symbol . content === "test2" ) {
607+ }
608+ if ( m && ! ( "lines" in m ) ) {
609+ lineArr . splice ( s , 0 , ...m . parts ) ;
610+ return getNextSymbol ( helper ) ;
611+ }
579612 }
580613 return {
581614 type : symbol . type ,
@@ -1031,6 +1064,10 @@ function assemble(files: [string, string][]) {
10311064 case "unknown" :
10321065 const macro = macros . get ( sym . content ) ;
10331066 if ( macro ) {
1067+ if ( ! ( "lines" in macro ) ) {
1068+ return ;
1069+ }
1070+
10341071 let argBuild : symbolType [ ] = [ ] ;
10351072 let thing = getNextSymbol ( ) ;
10361073 if ( thing ) {
@@ -1043,6 +1080,7 @@ function assemble(files: [string, string][]) {
10431080 }
10441081 }
10451082 }
1083+
10461084 if ( argBuild . length !== macro . args . length ) {
10471085 if ( argBuild . length > macro . args . length ) {
10481086 throw new AssemblError (
0 commit comments