#58: fixed /**/ comment termination

This commit is contained in:
z7zmey 2018-07-23 20:33:45 +03:00
parent 4d2484867b
commit 1a495d615b
3 changed files with 2975 additions and 2936 deletions

File diff suppressed because it is too large Load Diff

View File

@ -286,6 +286,8 @@ NEW_LINE (\r|\n|\r\n)
l.addComment(tb)
<PHP>[/][*][*][/]
l.addComment(l.Token())
<PHP>([/][*])|([/][*][*])
tb := l.Token()
is_doc_comment := false

View File

@ -1024,9 +1024,27 @@ func TestInlineComment(t *testing.T) {
assertEqual(t, expected, actual)
}
func TestInlineComment2(t *testing.T) {
src := `<?php
/*/*/`
expected := []*comment.Comment{
comment.NewComment("/*/*/", position.NewPosition(2, 2, 8, 12)),
}
lexer := scanner.NewLexer(bytes.NewBufferString(src), "test.php")
lv := &lval{}
lexer.Lex(lv)
actual := lexer.Comments
assertEqual(t, expected, actual)
}
func TestEmptyInlineComment(t *testing.T) {
src := `<?php
/**/`
/**/ `
expected := []*comment.Comment{
comment.NewComment("/**/", position.NewPosition(2, 2, 8, 11)),