-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d240f78
commit 6d10224
Showing
2,048 changed files
with
584,166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!-- | ||
~ This file is part of Cosmic IDE. | ||
~ Cosmic IDE is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
~ Cosmic IDE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
~ You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see <https://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<vector android:autoMirrored="true" android:height="24dp" | ||
android:tint="#000000" android:viewportHeight="24" | ||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M18.4,10.6C16.55,8.99 14.15,8 11.5,8c-4.65,0 -8.58,3.03 -9.96,7.22L3.9,16c1.05,-3.19 4.05,-5.5 7.6,-5.5 1.95,0 3.73,0.72 5.12,1.88L13,16h9V7l-3.6,3.6z"/> | ||
</vector> |
45 changes: 45 additions & 0 deletions
45
feature/formatter/google-java-format/src/main/java/com/google/googlejavaformat/CloseOp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2015 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.googlejavaformat; | ||
|
||
import com.google.common.base.MoreObjects; | ||
|
||
/** | ||
* A {@code CloseOp} closes a level. It is an {@link Op} in the sequence of {@link Op}s generated by | ||
* {@link OpsBuilder}. When the sequence is turned into a {@link Doc} by {@link DocBuilder}, ranges | ||
* delimited by {@link OpenOp}-{@code CloseOp} pairs turn into nested {@link Doc.Level}s. | ||
*/ | ||
public enum CloseOp implements Op { | ||
CLOSE; | ||
|
||
/** | ||
* Make a {@code CloseOp}, returning a singleton since they are all the same. | ||
* | ||
* @return the singleton {@code CloseOp} | ||
*/ | ||
public static Op make() { | ||
return CLOSE; | ||
} | ||
|
||
@Override | ||
public void add(DocBuilder builder) { | ||
builder.close(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MoreObjects.toStringHelper(this).toString(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...ormatter/google-java-format/src/main/java/com/google/googlejavaformat/CommentsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2015 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.googlejavaformat; | ||
|
||
import com.google.googlejavaformat.Input.Tok; | ||
import java.util.Optional; | ||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* Rewrite comments. This interface is implemented by {@link | ||
* com.google.googlejavaformat.java.JavaCommentsHelper JavaCommentsHelper}. | ||
*/ | ||
public interface CommentsHelper { | ||
/** | ||
* Try to rewrite comments, returning rewritten text. | ||
* | ||
* @param tok the comment's tok | ||
* @param maxWidth the line length for the output | ||
* @param column0 the current column | ||
* @return the rewritten comment | ||
*/ | ||
String rewrite(Input.Tok tok, int maxWidth, int column0); | ||
|
||
static Optional<String> reformatParameterComment(Tok tok) { | ||
if (!tok.isSlashStarComment()) { | ||
return Optional.empty(); | ||
} | ||
var match = PARAMETER_COMMENT.matcher(tok.getOriginalText()); | ||
if (!match.matches()) { | ||
return Optional.empty(); | ||
} | ||
return Optional.of(String.format("/* %s= */", match.group(1))); | ||
} | ||
|
||
Pattern PARAMETER_COMMENT = | ||
Pattern.compile( | ||
"/\\*\\s*(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*(\\Q...\\E)?)\\s*=\\s*\\*/"); | ||
} |
Oops, something went wrong.