Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit f73a977

Browse files
Support for Rust
1 parent e8c3f50 commit f73a977

File tree

14 files changed

+2739
-4
lines changed

14 files changed

+2739
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ dependencies {
556556
implementation 'com.blacksquircle.ui:language-plaintext:2.7.0'
557557
implementation 'com.blacksquircle.ui:language-python:2.7.0'
558558
implementation 'com.blacksquircle.ui:language-ruby:2.7.0'
559+
implementation 'com.blacksquircle.ui:language-rust:2.7.0'
559560
implementation 'com.blacksquircle.ui:language-shell:2.7.0'
560561
implementation 'com.blacksquircle.ui:language-smali:2.7.0'
561562
implementation 'com.blacksquircle.ui:language-sql:2.7.0'

language-fortran/src/main/kotlin/com/blacksquircle/ui/language/fortran/lexer/FortranLexer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,7 @@ else if (zzAtEOF) {
17541754
// fall through
17551755
case 204: break;
17561756
case 19:
1757-
{ return FortranToken.TWO_COLON;
1757+
{ return FortranToken.DOUBLE_COLON;
17581758
}
17591759
// fall through
17601760
case 205: break;

language-fortran/src/main/kotlin/com/blacksquircle/ui/language/fortran/lexer/FortranToken.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ enum class FortranToken {
191191
DIVEQ,
192192
EQEQ,
193193
EQ_OPERATOR,
194-
TWO_COLON,
194+
DOUBLE_COLON,
195195
LT,
196196
GT,
197197
EQ,

language-fortran/src/main/kotlin/com/blacksquircle/ui/language/fortran/lexer/fortran.flex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ LINE_COMMENT = "!".*
221221
"/=" { return FortranToken.DIVEQ; }
222222
"==" { return FortranToken.EQEQ; }
223223
"=" { return FortranToken.EQ_OPERATOR; }
224-
"::" { return FortranToken.TWO_COLON; }
224+
"::" { return FortranToken.DOUBLE_COLON; }
225225
".lt." { return FortranToken.LT; }
226226
".gt." { return FortranToken.GT; }
227227
".eq." { return FortranToken.EQ; }

language-fortran/src/main/kotlin/com/blacksquircle/ui/language/fortran/styler/FortranStyler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class FortranStyler private constructor() : LanguageStyler {
245245
FortranToken.DIVEQ,
246246
FortranToken.EQEQ,
247247
FortranToken.EQ_OPERATOR,
248-
FortranToken.TWO_COLON,
248+
FortranToken.DOUBLE_COLON,
249249
FortranToken.LT,
250250
FortranToken.GT,
251251
FortranToken.EQ,

language-rust/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

language-rust/build.gradle.kts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2023 Squircle CE contributors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
id("language-module")
19+
id("publish-module")
20+
}
21+
22+
publishModule {
23+
libraryGroup = "com.blacksquircle.ui"
24+
libraryArtifact = "language-rust"
25+
libraryVersion = "2.8.0"
26+
}
27+
28+
dependencies {
29+
30+
// Modules
31+
api(project(":editorkit:language-base"))
32+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2023 Squircle CE contributors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.blacksquircle.ui.language.rust
18+
19+
import com.blacksquircle.ui.language.base.Language
20+
import com.blacksquircle.ui.language.base.parser.LanguageParser
21+
import com.blacksquircle.ui.language.base.provider.SuggestionProvider
22+
import com.blacksquircle.ui.language.base.styler.LanguageStyler
23+
import com.blacksquircle.ui.language.rust.parser.RustParser
24+
import com.blacksquircle.ui.language.rust.provider.RustProvider
25+
import com.blacksquircle.ui.language.rust.styler.RustStyler
26+
27+
class RustLanguage : Language {
28+
29+
companion object {
30+
const val LANGUAGE_NAME = "rust"
31+
}
32+
33+
override val languageName = LANGUAGE_NAME
34+
35+
override fun getParser(): LanguageParser {
36+
return RustParser.getInstance()
37+
}
38+
39+
override fun getProvider(): SuggestionProvider {
40+
return RustProvider.getInstance()
41+
}
42+
43+
override fun getStyler(): LanguageStyler {
44+
return RustStyler.getInstance()
45+
}
46+
}

0 commit comments

Comments
 (0)