Skip to content

Commit 07bd715

Browse files
committed
0.14.0 - Moved twg2.parser.text package to new jtext-tokenizer library, renamed classes/methods with the word 'Fragment' to 'Token'; i.e. CodeFragmentType -> CodeTokenType, see CHANGELOG for full details.
1 parent 76734b1 commit 07bd715

File tree

94 files changed

+758
-3923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+758
-3923
lines changed

.classpath

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="src" path="plugins"/>
@@ -44,6 +44,8 @@
4444
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jstreamish/bin/jstreamish.jar" sourcepath="/JStreamish"/>
4545
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-parser/bin/jtext_parser.jar" sourcepath="/JTextParser"/>
4646
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-template/bin/jtext_template.jar" sourcepath="/JTextTemplate"/>
47+
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-tokenizer/bin/jtext_tokenizer-with-tests.jar" sourcepath="/JTextTokenizer"/>
48+
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-tokenizer/bin/jtext_tokenizer.jar" sourcepath="/JTextTokenizer"/>
4749
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-util/bin/jtext_util.jar" sourcepath="/JTextUtil"/>
4850
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtree-walker/bin/jtree_walker.jar" sourcepath="/JTreeWalker"/>
4951
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtuples/bin/jtuples.jar" sourcepath="/JTuples"/>

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ This project does its best to adhere to [Semantic Versioning](http://semver.org/
44

55

66
--------
7-
###[0.13.0](N/A) - 2016-10-26
7+
###[0.14.0](N/A) - 2016-10-30
8+
#### Changed
9+
__Reduced library complexity/scope by moving twg2.parser.text conditions/tokenizers to separate [jtext-tokenizer](https://github.com/TeamworkGuy2/JTextTokenizer) library__
10+
* Moved twg2.parser.text package to jtext-tokenizer library
11+
* Moved twg2.parser.Inclusion to jtext-parser library
12+
* Renamed classes *Fragment -> *Token:
13+
* CodeFragment -> CodeToken
14+
* CodeFragmentType -> CodeTokenType
15+
* DocumentFragment -> TextToken and renamed methods:
16+
* getTextFragment() -> getToken()
17+
* getFragmentType() -> getTokenType()
18+
* DocumentFragmentText -> TextFragmentRefToken
19+
* CodeFragmentEnumSubSet -> CodeTokenEnumSubSet
20+
* Renamed twg2.parser.codeParser.tools.performance -> twg2.parser.codeParser.analytics
21+
* TokenizeStepDetails -> TokenizeStepLogger and now implements TypedLogger from jtext-tokenizer library
22+
23+
#### Removed
24+
* Removed twg2.parser.text package (moved to jtext-tokenizer library)
25+
26+
27+
--------
28+
###[0.13.0](https://github.com/TeamworkGuy2/JParseCode/commit/76734b17d16c67a89df7245a2cea2a1133c3b6b0) - 2016-10-26
829
#### Added
930
* Added ParameterSig and ParameterSigResolved 'parameterModifiers' field
1031
* Added KeywordUtil parameterModifiers() and isParameterModifier()

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
JParseCode
22
==============
3-
version: 0.13.0
3+
version: 0.14.0
44

55
In progress C#/Java/TypeScript parser tools built atop [JTextParser] (https://github.com/TeamworkGuy2/JTextParser), [Jackson] (https://github.com/FasterXML/jackson-core/) (core, databind, annotations) and half a dozen other utility libraries.
66

@@ -9,7 +9,7 @@ In progress C#/Java/TypeScript parser tools built atop [JTextParser] (https://gi
99
* A code first parser aimed at manipulating the resulting AST and writing it back as source code or JSON. With the goal of allowing simple language constructs like interfaces and data models to be transpiled to different languages.
1010

1111
### Not Goals:
12-
* NOT to create another compiler for C#, Java, or JS/TS. This project's parser expects valid code as input, the few error messages that are present are NOT design to highlight syntax errors in the input.
12+
* NOT to create another compiler for C#, Java, or JavaScript/TypeScript. This project's parser expects valid code as input, the few error messages that are present are NOT design to highlight syntax errors in the input.
1313
* NOT to create a valid AST for each supported language. Rather an AST like structure that supports the lowest common denominator between the targeted languages. This means many AST compromises are inevitable due to differences in language specs.
1414

1515

@@ -65,7 +65,7 @@ Java code to parser SimpleCs.cs (simple_cs_source_string is a string containing
6565
CodeFileSrc<CodeLanguage> simpleCsAst = ParseCodeFile.parseCode("SimpleCs.cs", CodeLanguageOptions.C_SHARP, simple_cs_source_string);
6666
WriteSettings ws = new WriteSettings(true, true, true, true);
6767

68-
for(Map.Entry<SimpleTree<DocumentFragmentText<CodeFragmentType>>, IntermClass.SimpleImpl<CsBlock>> block : CodeLanguageOptions.C_SHARP.getExtractor().extractClassFieldsAndMethodSignatures(simpleCsAst.getDoc())) {
68+
for(Map.Entry<SimpleTree<CodeToken>, ClassAst.SimpleImpl<CsBlock>> block : CodeLanguageOptions.C_SHARP.getExtractor().extractClassFieldsAndMethodSignatures(simpleCsAst.getDoc())) {
6969
CodeFileParsed.Simple<String, CsBlock> fileParsed = new CodeFileParsed.Simple<>("SimpleCs.cs", block.getValue(), block.getKey());
7070

7171
StringBuilder sb = new StringBuilder();

bin/jparse_code-with-tests.jar

-67.8 KB
Binary file not shown.

bin/jparse_code.jar

-68.4 KB
Binary file not shown.

package-lib.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version" : "0.13.0",
2+
"version" : "0.14.0",
33
"name" : "jparse-code",
44
"description" : "An in-progress suite of parsing/transpilation tools for C#, Java, and TypeScript code. Generates simple JSON ASTs.",
55
"homepage" : "https://github.com/TeamworkGuy2/JParseCode",
@@ -25,6 +25,7 @@
2525
"json-stringify": "*",
2626
"jstreamish": "*",
2727
"jtext-parser": "*",
28+
"jtext-tokenizer": "*",
2829
"jtext-util": "*",
2930
"jtree-walker": "*",
3031
"jtuples": "*"

src/twg2/ast/interm/block/BlockAst.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import twg2.annotations.Immutable;
55
import twg2.ast.interm.classes.ClassSig;
66
import twg2.parser.codeParser.BlockType;
7-
import twg2.parser.fragment.CodeFragment;
7+
import twg2.parser.fragment.CodeToken;
88
import twg2.treeLike.simpleTree.SimpleTree;
99

1010
/**
@@ -14,11 +14,11 @@
1414
@Immutable
1515
public class BlockAst<T_BLOCK extends BlockType> {
1616
private final @Getter ClassSig.SimpleImpl declaration;
17-
private final @Getter SimpleTree<CodeFragment> blockTree;
17+
private final @Getter SimpleTree<CodeToken> blockTree;
1818
private final @Getter T_BLOCK blockType;
1919

2020

21-
public BlockAst(ClassSig.SimpleImpl declaration, SimpleTree<CodeFragment> blockTree, T_BLOCK blockType) {
21+
public BlockAst(ClassSig.SimpleImpl declaration, SimpleTree<CodeToken> blockTree, T_BLOCK blockType) {
2222
this.declaration = declaration;
2323
this.blockTree = blockTree;
2424
this.blockType = blockType;

src/twg2/ast/interm/field/FieldDef.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import twg2.parser.codeParser.AccessModifier;
1313
import twg2.parser.codeParser.extractors.DataTypeExtractor;
1414
import twg2.parser.codeParser.tools.NameUtil;
15-
import twg2.parser.fragment.CodeFragment;
16-
import twg2.parser.fragment.CodeFragmentType;
15+
import twg2.parser.fragment.CodeToken;
16+
import twg2.parser.fragment.CodeTokenType;
1717
import twg2.parser.output.WriteSettings;
1818
import twg2.text.stringEscape.StringEscapeJson;
1919
import twg2.treeLike.simpleTree.SimpleTree;
@@ -24,11 +24,11 @@
2424
*/
2525
@Immutable
2626
public class FieldDef extends FieldSig {
27-
private final @Getter SimpleTree<CodeFragment> initializer;
27+
private final @Getter SimpleTree<CodeToken> initializer;
2828

2929

3030
public FieldDef(String name, List<String> fullName, TypeSigSimple fieldType, List<AccessModifier> accessModifiers,
31-
List<AnnotationSig> annotations, List<String> comments, SimpleTree<CodeFragment> initializer) {
31+
List<AnnotationSig> annotations, List<String> comments, SimpleTree<CodeToken> initializer) {
3232
super(name, fullName, fieldType, accessModifiers, annotations, comments);
3333
this.initializer = initializer;
3434
}
@@ -68,12 +68,12 @@ public String toString() {
6868
/** Write a field initializer to a JSON field named 'initializer' if the value is a number, boolean, string, or null literal, else write it to a field named 'initializerExpression'
6969
* @throws IOException
7070
*/
71-
public static void initializerToJson(SimpleTree<CodeFragment> astNode, boolean preClosingComma, Appendable dst, WriteSettings st) throws IOException {
72-
CodeFragment data = null;
71+
public static void initializerToJson(SimpleTree<CodeToken> astNode, boolean preClosingComma, Appendable dst, WriteSettings st) throws IOException {
72+
CodeToken data = null;
7373
boolean isNumOrBoolOrNull = false;
7474
if(astNode != null && !astNode.hasChildren() && (data = astNode.getData()) != null &&
75-
(data.getFragmentType() == CodeFragmentType.STRING ||
76-
(isNumOrBoolOrNull = (data.getFragmentType() == CodeFragmentType.NUMBER || DataTypeExtractor.isBooleanLiteral(data) || DataTypeExtractor.isNullLiteral(data))))) {
75+
(data.getTokenType() == CodeTokenType.STRING ||
76+
(isNumOrBoolOrNull = (data.getTokenType() == CodeTokenType.NUMBER || DataTypeExtractor.isBooleanLiteral(data) || DataTypeExtractor.isNullLiteral(data))))) {
7777
if(preClosingComma) {
7878
dst.append(", ");
7979
}

src/twg2/ast/interm/field/FieldDefResolved.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import twg2.io.json.stringify.JsonStringify;
1212
import twg2.parser.codeParser.AccessModifier;
1313
import twg2.parser.codeParser.tools.NameUtil;
14-
import twg2.parser.fragment.CodeFragment;
14+
import twg2.parser.fragment.CodeToken;
1515
import twg2.parser.output.WriteSettings;
1616
import twg2.treeLike.simpleTree.SimpleTree;
1717

@@ -21,11 +21,11 @@
2121
*/
2222
@Immutable
2323
public class FieldDefResolved extends FieldSigResolved {
24-
private final @Getter SimpleTree<CodeFragment> initializer;
24+
private final @Getter SimpleTree<CodeToken> initializer;
2525

2626

2727
public FieldDefResolved(String name, List<String> fullName, TypeSigResolved fieldType, List<AccessModifier> accessModifiers,
28-
List<AnnotationSig> annotations, List<String> comments, SimpleTree<CodeFragment> initializer) {
28+
List<AnnotationSig> annotations, List<String> comments, SimpleTree<CodeToken> initializer) {
2929
super(name, fullName, fieldType, accessModifiers, annotations, comments);
3030
this.initializer = initializer;
3131
}

src/twg2/parser/Inclusion.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)