#58: fixed /**/
comment termination
This commit is contained in:
parent
4d2484867b
commit
1a495d615b
5795
scanner/scanner.go
5795
scanner/scanner.go
File diff suppressed because it is too large
Load Diff
@ -286,6 +286,8 @@ NEW_LINE (\r|\n|\r\n)
|
|||||||
|
|
||||||
l.addComment(tb)
|
l.addComment(tb)
|
||||||
|
|
||||||
|
<PHP>[/][*][*][/]
|
||||||
|
l.addComment(l.Token())
|
||||||
<PHP>([/][*])|([/][*][*])
|
<PHP>([/][*])|([/][*][*])
|
||||||
tb := l.Token()
|
tb := l.Token()
|
||||||
is_doc_comment := false
|
is_doc_comment := false
|
||||||
|
@ -1024,9 +1024,27 @@ func TestInlineComment(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
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) {
|
func TestEmptyInlineComment(t *testing.T) {
|
||||||
src := `<?php
|
src := `<?php
|
||||||
/**/`
|
/**/ `
|
||||||
|
|
||||||
expected := []*comment.Comment{
|
expected := []*comment.Comment{
|
||||||
comment.NewComment("/**/", position.NewPosition(2, 2, 8, 11)),
|
comment.NewComment("/**/", position.NewPosition(2, 2, 8, 11)),
|
||||||
|
Loading…
Reference in New Issue
Block a user