Skip to content

Commit 07c397d

Browse files
authored
Merge pull request #36 from PanAeon/feature/nested_comments
Fix nested comments ...
2 parents 5211d13 + be15605 commit 07c397d

File tree

5 files changed

+682
-21
lines changed

5 files changed

+682
-21
lines changed

src/typescript/Scala.tmLanguage.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,6 @@ export const scalaTmLanguage: TmLanguage = {
119119
}
120120
]
121121
},
122-
'block-comments': {
123-
end: '\\*/',
124-
begin: '/\\*',
125-
patterns: [
126-
{
127-
include: '#block-comments'
128-
},
129-
{
130-
match: '(?x)(?! /\\*)(?! \\*/)'
131-
}
132-
],
133-
name: 'comment.block.scala'
134-
},
135122
'script-header': {
136123
match: '^#!(.*)$',
137124
captures: {
@@ -697,7 +684,7 @@ export const scalaTmLanguage: TmLanguage = {
697684
}
698685
},
699686
{
700-
match: '@(return|see|note|example|usecase|author|version|since|todo|deprecated|migration|define|inheritdoc)\\b',
687+
match: '@(return|see|note|example|constructor|usecase|author|version|since|todo|deprecated|migration|define|inheritdoc)\\b',
701688
name: 'keyword.other.documentation.scaladoc.scala'
702689
},
703690
{
@@ -707,12 +694,15 @@ export const scalaTmLanguage: TmLanguage = {
707694
name: 'punctuation.definition.documentation.link.scala'
708695
},
709696
'2': {
710-
name: 'entity.other.documentation.link.scala'
697+
name: 'string.other.link.title.markdown'
711698
},
712699
'3': {
713700
name: 'punctuation.definition.documentation.link.scala'
714701
}
715702
}
703+
},
704+
{
705+
"include": "#comments"
716706
}
717707
],
718708
endCaptures: {
@@ -730,6 +720,11 @@ export const scalaTmLanguage: TmLanguage = {
730720
name: 'punctuation.definition.comment.scala'
731721
}
732722
},
723+
patterns: [
724+
{
725+
"include": "#comments"
726+
}
727+
],
733728
name: 'comment.block.scala'
734729
},
735730
{

syntaxes/Scala.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/snap/comments.test.scala

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/// SYNTAX TEST "source.scala"
2+
#!/usr/bin/env scala
3+
4+
// single line comments
5+
6+
/* /**/ /** */ /* comments within comments */ */
7+
8+
/** /* */ /** **/ **/
9+
10+
11+
/************************
12+
*
13+
* [[scala.Option]]
14+
* @return smth
15+
***********************/
16+
17+
case class C(val x: Int) {
18+
def f(p:Double) : String = {
19+
20+
}
21+
}
22+
23+
/** Provides classes for dealing with complex numbers. Also provides
24+
* implicits for converting to and from `Int`.
25+
*
26+
* ==Overview==
27+
* The main class to use is [[my.package.complex.Complex]], as so
28+
* {{{
29+
* scala> val complex = Complex(4,3)
30+
* complex: my.package.complex.Complex = 4 + 3i
31+
* }}}
32+
*
33+
* If you include [[my.package.complex.ComplexConversions]], you can
34+
* convert numbers more directly
35+
* {{{
36+
* scala> import my.package.complex.ComplexConversions._
37+
* scala> val complex = 4 + 3.i
38+
* complex: my.package.complex.Complex = 4 + 3i
39+
* }}}
40+
*/
41+
package complex {}
42+
43+
/** A person who uses our application.
44+
*
45+
* @constructor create a new person with a name and age.
46+
* @tparam T useless param
47+
* @param name the person's name
48+
* @param age the person's age in years
49+
* @throws java.lang.Exception
50+
*
51+
* @see reference other sources of information like external document links or related entities in the documentation.
52+
* @note add a note for pre or post conditions, or any other notable restrictions or expectations.
53+
* @example for providing example code or related example documentation.
54+
* @usecase def apply(name: String, age: Int) : Unit
55+
*
56+
* @groupname group name
57+
* @groupprio group 2
58+
* @groupdesc group desc
59+
* @group group
60+
* @contentDiagram
61+
*
62+
*
63+
* @author provide author information for the following entity
64+
* @version the version of the system or API that this entity is a part of.
65+
* @since like @version but defines the system or API that this entity was first defined in.
66+
* @todo for documenting unimplemented features or unimplemented aspects of an entity.
67+
* @deprecated marks the entity as deprecated, providing both the replacement implementation that should be used and the version/date at which this entity was deprecated.
68+
* @migration like deprecated but provides advanced warning of planned changes ahead of deprecation. Same fields as @deprecated.
69+
* @inheritdoc take comments from a superclass as defaults if comments are not provided locally.
70+
* @documentable Expand a type alias and abstract type into a full template page. - TODO: Test the “abstract type” claim - no examples of this in the Scala code base
71+
*
72+
* @define <name> <definition>
73+
*
74+
* @shortDescription ???
75+
* @hideImplicitConversion ???
76+
*
77+
*/
78+
class Person[T](name: String, age: Int) {
79+
}
80+
81+
/** Factory for [[mypackage.Person]] instances. */
82+
object Person {
83+
/** Creates a person with a given name and age.
84+
*
85+
* @param name their name
86+
* @param age the age of the person to create
87+
*/
88+
def apply(name: String, age: Int) = {}
89+
90+
/** Creates a person with a given name and birthdate
91+
*
92+
* @param name their name
93+
* @param birthDate the person's birthdate
94+
* @return a new Person instance with the age determined by the
95+
* birthdate and current date.
96+
*/
97+
def apply(name: String, birthDate: java.util.Date) = {}
98+
}
99+
100+
/** Implicit conversions and helpers for [[mypackage.Complex]] instances.
101+
*
102+
* {{{
103+
* import ComplexImplicits._
104+
* val c: Complex = 4 + 3.i
105+
* }}}
106+
*/
107+
object ComplexImplicits {}
108+
109+
/**
110+
* =Heading=, ==Sub-Heading==
111+
*
112+
* `monospace`
113+
* ''italic text''
114+
* '''bold text'''
115+
* __underline__
116+
* ^superscript^
117+
* ,,subscript,,
118+
* [[entity link]], e.g. [[scala.collection.Seq]]
119+
* [[http://external.link External Link]],
120+
* e.g. [[http://scala-lang.org Scala Language Site]]
121+
*
122+
*/
123+
object Markup {
124+
/** Here is an unordered list:
125+
*
126+
* - First item
127+
* - Second item
128+
* - Sub-item to the second
129+
* - Another sub-item
130+
* - Third item
131+
*
132+
* Here is an ordered list:
133+
*
134+
* 1. First numbered item
135+
* 1. Second numbered item
136+
* i. Sub-item to the second
137+
* i. Another sub-item
138+
* 1. Third item
139+
*/
140+
def lists = ()
141+
}

0 commit comments

Comments
 (0)