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

fix: alignment issue #88 #89 #98

Merged
merged 12 commits into from
Dec 7, 2023
Merged

fix: alignment issue #88 #89 #98

merged 12 commits into from
Dec 7, 2023

Conversation

unimu-cic
Copy link
Collaborator

@unimu-cic unimu-cic commented Nov 28, 2023

Test case 1

// Issue #88
A->A.method {
  // [bold, red]Issue #89
  B:async message
}

A.method() {
  B:method
  self() {
    // [bold, red] similar issue
    B:method
  }
}

A->B:message

A->B.method


A->B.method {
  // [red, bold] issue #89
  A:method
}

A->A.method()
image

Test case 2

BookLibService.Borrow(id) {
  User = Session.GetUser()
  if(User.isActive) {
    try {
      BookRepository.Update(id, onLoan, User)
      receipt = new Receipt(id, dueDate)
    } catch (BookNotFoundException) {
      ErrorService.onException(BookNotFoundException)
    } finally {
      Connection.close()
    }
  }
  return receipt
}
image

Test case 3

Client->SGW."Get order by id" {
  svc.Get(id) {
    new X()
    rep."load order" {
      =="Start Here"==
      MF."load order from mainframe"
      =="End Here"==
      if(order == null) {
        @return 
        SGW->Client:404
      } else {
        return order
      }
      
      while(true) {
        svc.refresh(data)
      }
      processOrder()
    }
    return order
  }
  return response
}
image

Test case 4

// This is a sample
A.do() {
  if (condition1) {
    X.doSomething()
  } else if (condition2) {
    Y.doSomethingElse
  } else {
    doNothing()
  }
}
image

Test case 5

// This is a sample
A.method() {
  if(condition) {
    B.method()
  }
}
image

@unimu-cic unimu-cic marked this pull request as draft November 28, 2023 05:28
@unimu-cic unimu-cic marked this pull request as ready for review November 28, 2023 05:52
@MrCoder
Copy link
Collaborator

MrCoder commented Nov 28, 2023

Edge cases:

should be fixed.

SCR-20231128-tmin SCR-20231128-tohk SCR-20231128-tpxg SCR-20231128-tskx

nice to be fixed.

However, they are acceptable as long as it is consistent.
SCR-20231128-tmin

@MrCoder
Copy link
Collaborator

MrCoder commented Nov 28, 2023

The following DSL could be used as a one-for-all example.

// comments at the beginning should be ignored
title This is a title
@Lambda <<stereotype>> ParticipantName
group "B C" {@EC2 B @ECS C}
"bg color" #FF0000
@Starter("ParticipantName")
new B
ReturnType ret = ParticipantName.methodA(a, b) {
  // Customised style for RESTFul API - `POST /order` <br>
  ReturnType ret2 = selfCall() {
    B.syncCallWithinSelfCall() {
      ParticipantName.rightToLeftCall()
      return B
    }
    "space in name"->"bg color".syncMethod(from, to)
  }
  // A comment for alt
  if (condition) {
    // A comment for creation
    ret = new CreatAndAssign()
    "ret:CreatAndAssign".method(create, and, assign)
    // A comment for async self
    B->B: Self Async
    // A comment for async message
    B->C: Async Message within fragment
    new Creation() {
      return from_creation
    }
    return "from if to original source"
    try {
      new AHasAVeryLongNameLongNameLongNameLongName() {
        new CreatWithinCreat()
        C.rightToLeftFromCreation() {
          B.FurtherRightToLeftFromCreation()
        }
      }
    } catch (Exception) {
      self {
        return C
      }
    } finally {
      C: async call from implied source  
    }
    =====divider can be anywhere=====
  } else if ("another condition") {
    par {
      B.method
      C.method
    }
  } else {
    // A comment for loop
    forEach(Z) {
      Z.method() {
        return Z
      }
    }
  }
}

@unimu-cic unimu-cic marked this pull request as draft November 28, 2023 12:19
@unimu-cic
Copy link
Collaborator Author

All the above edge cases are fixed, except the largest DSL.

A->A.method() {
	B.method() {
    	A.method
    }
}

if(condition) {
	A->A.method
}

A->A.method {
	B.method
}

A->A.method {
	B->C.method
}

A.method() {
	B.method() {
    	A:method
    }
}

// Issue #88
A->A.method {
  // [bold, red]Issue #89
  B:async message
}

A.method() {
  B:method
  self() {
    // [bold, red] similar issue
    B:method
  }
}

A->B:message

A->B.method

A->B.method {
  // [red, bold] issue #89
  A:method
}
image

@unimu-cic unimu-cic marked this pull request as ready for review December 4, 2023 13:57
@MrCoder
Copy link
Collaborator

MrCoder commented Dec 4, 2023

case 1: Creation message occurrence not aligned

@Starter(A)
new B
image

case 2: messages with "ProvidedFrom"

A B C
A.method1 {
  C->B.syncMethodRightToLeft
  C->B:asyncMethodRightToLeft
  // [green] OK
  C->D.syncMethodLeftToRight
  C->D:asyncMethodLeftToRight
}
image

Copy link
Collaborator

@MrCoder MrCoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 2 cases that should be fixed.

@unimu-cic unimu-cic added the bug Something isn't working label Dec 5, 2023
@unimu-cic unimu-cic removed the bug Something isn't working label Dec 6, 2023
@MrCoder MrCoder merged commit b58d0c5 into main Dec 7, 2023
12 checks passed
@MrCoder MrCoder deleted the fix/alignment-issues-#88-#89 branch April 29, 2024 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants