-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from nakshay/languagefeature
Languagefeature merge with Master branch
- Loading branch information
Showing
15 changed files
with
295 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
## How to contribute | ||
|
||
|
||
1. Fork TextHighlighter | ||
1. Check out the `develop` branch | ||
1. Make a feature branch (use `git checkout -b "new-feature"`) | ||
1. Make your new feature or bugfix on your branch | ||
1. From your branch, make a pull request against `nakshay/TextHighlighter/develop` | ||
1. Wait for your change to be pulled into `nakshay/TextHighlighter/develop` | ||
1. Merge `nakshay/TextHighlighter/develop` into your origin `develop` | ||
1. Delete your feature branch |
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
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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sat Dec 03 16:42:48 IST 2016 | ||
#Sat Apr 29 18:32:51 IST 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip |
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
53 changes: 53 additions & 0 deletions
53
texthighlighterapi/src/main/java/com/github/akshay_naik/texthighlighterapi/C.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,53 @@ | ||
package com.github.akshay_naik.texthighlighterapi; | ||
|
||
/** | ||
* Created by akshay on 30/04/17. | ||
*/ | ||
|
||
class C implements Language{ | ||
|
||
|
||
//define all token in lowercase, even though text to be highlighted is in uppercase | ||
|
||
final String[] tokens={"auto","double","int","struct","const","float","short","unsigned","break","else","long","switch","continue","for","signed", | ||
"void","case","enum","register","typedef","default","goto","sizeof","volatile","char","extern","return","union","do","if","static", | ||
"while"}; | ||
|
||
final String[] operators={"+","-","/","*","%","=","+=","-=","*=","/=", | ||
"%=","&=","^=","<",">","<=",">=","==","!=","&&","||","!","&","|","~","^","<<", | ||
">>","?",":","Sizeof","++","--","<", "<<","printf","scanf"}; | ||
|
||
final String[] symbols={"(",")","{","}","[","]", "#include"}; | ||
|
||
final String[] comments={"/*", "*/","//"}; | ||
|
||
|
||
C() | ||
{ | ||
for (String token:tokens) { | ||
colorMap.put(token,"red"); | ||
} | ||
|
||
for (String operator:operators) { | ||
colorMap.put(operator,"#2C5A2E"); | ||
} | ||
for (String comment:comments) { | ||
colorMap.put(comment,"purple"); | ||
} | ||
for (String symbol: symbols) { | ||
colorMap.put(symbol,"blue"); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public String getColor(String myToken) { | ||
String color=colorMap.get(myToken.toLowerCase()); | ||
|
||
if(color==null) { | ||
color=defaultColor; | ||
} | ||
return color; | ||
} | ||
} | ||
|
49 changes: 49 additions & 0 deletions
49
texthighlighterapi/src/main/java/com/github/akshay_naik/texthighlighterapi/Cpp.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,49 @@ | ||
package com.github.akshay_naik.texthighlighterapi; | ||
|
||
|
||
/** | ||
* Created by akshay on 30/04/17. | ||
*/ | ||
|
||
class Cpp implements Language{ | ||
|
||
|
||
//define all token in lowercase, even though text to be highlighted is in uppercase | ||
|
||
final String[] operators = {">", "<", "<<", ">>","+","-","++","--","==","="}; | ||
final String[] symbols = {"#include", "//", "{", "}", "(", ")"}; | ||
final String[] comments = {"/*", "*/"}; | ||
final String[] tokens = {"iostream.h", "asm", " auto", " break", " case", " catch", " char", " class", " const", | ||
" continue", " default", " delete", " do", " double", " else", " enum", " extern", " float", | ||
" for", " friend", " goto", " if", " inline", " int", " long", " new", " operator", | ||
" private", " protected", " public", " register", " return", " short", | ||
" signed", " sizeof", " static", " struct", " switch", " template", " this", | ||
" throw", " try", " typedef", " union", " unsigned", " virtual", " void", " volatile", " while", "cout", "cin"}; | ||
|
||
Cpp() | ||
{ | ||
for (String token:tokens) { | ||
colorMap.put(token,"red"); | ||
} | ||
|
||
for (String operator:operators) { | ||
colorMap.put(operator,"#2C5A2E"); | ||
} | ||
for (String comment:comments) { | ||
colorMap.put(comment,"purple"); | ||
} | ||
for (String symbol: symbols) { | ||
colorMap.put(symbol,"blue"); | ||
} | ||
} | ||
|
||
@Override | ||
public String getColor(String myToken) { | ||
String color=colorMap.get(myToken.toLowerCase()); | ||
|
||
if(color==null) { | ||
color=defaultColor; | ||
} | ||
return color; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
texthighlighterapi/src/main/java/com/github/akshay_naik/texthighlighterapi/Java.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,51 @@ | ||
package com.github.akshay_naik.texthighlighterapi; | ||
|
||
/** | ||
* Created by akshay on 30/04/17. | ||
*/ | ||
|
||
class Java implements Language{ | ||
|
||
//define all token in lowercase, even though text to be highlighted is in uppercase | ||
|
||
|
||
final String[] operators={"+","-","/","*","%","=","+=","-=","*=","/=", | ||
"%=","&=","^=","<",">","<=",">=","==","!=","&&","||","!","&","|","~","^","<<", | ||
">>","?",":","<<=",">>=","++","--","<", "<<","println","print",">>>","<<<"}; | ||
|
||
final String[] tokens ={"abstract","assert boolean","break","byte","case","catch","char","class", | ||
"const","continue","default","do","double","else","enum ","extends","final","finally","float", | ||
"for","goto","if","implements","import","instanceof","int","interface","long","native","new","package", | ||
"private","protected","public","return","short","static","strictfp"," super","switch","synchronized", | ||
"this","throw","throws","transient","try","void","volatile","while"}; | ||
|
||
final String[] symbols = {"import", "//", "{", "}", "(", ")"}; | ||
|
||
final String[] comments={"/*", "*/","//"}; | ||
|
||
Java() { | ||
for (String token:tokens) { | ||
colorMap.put(token,"red"); | ||
} | ||
|
||
for (String operator:operators) { | ||
colorMap.put(operator,"#2C5A2E"); | ||
} | ||
for (String comment:comments) { | ||
colorMap.put(comment,"purple"); | ||
} | ||
for (String symbol: symbols) { | ||
colorMap.put(symbol,"blue"); | ||
} | ||
} | ||
|
||
@Override | ||
public String getColor(String myToken) { | ||
String color=colorMap.get(myToken.toLowerCase()); | ||
|
||
if(color==null) { | ||
color=defaultColor; | ||
} | ||
return color; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
texthighlighterapi/src/main/java/com/github/akshay_naik/texthighlighterapi/Language.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,13 @@ | ||
package com.github.akshay_naik.texthighlighterapi; | ||
|
||
import java.util.HashMap; | ||
|
||
/** | ||
* Created by akshay on 30/04/17. | ||
*/ | ||
|
||
interface Language { | ||
HashMap<String,String> colorMap= new HashMap<>(); | ||
String getColor(String myToken); | ||
String defaultColor = "black"; | ||
} |
29 changes: 29 additions & 0 deletions
29
...ghlighterapi/src/main/java/com/github/akshay_naik/texthighlighterapi/LibraryConstant.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,29 @@ | ||
package com.github.akshay_naik.texthighlighterapi; | ||
|
||
/** | ||
* Created by akshay on 29/04/17. | ||
*/ | ||
|
||
public interface LibraryConstant { | ||
|
||
public interface LanguageConstant { | ||
|
||
public static String JAVA="JAVA"; | ||
public static String C="C"; | ||
public static String CPP="C++"; | ||
} | ||
|
||
public interface StyleConstant { | ||
|
||
//pre-defined Styles | ||
|
||
public static final String NORMAL="NORMAL"; | ||
public static final String BOLD="BOLD"; | ||
public static final String ITALIC="ITALIC"; | ||
public static final String UNDERLINE="UNDERLINE"; | ||
public static final String SUPERSCRIPT="SUPERSCRIPT"; | ||
public static final String SUBSCRIPT="SUBSCRIPT"; | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.