Skip to content

Commit

Permalink
Update newproject/ and README to use 4.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeRanDev committed Oct 20, 2023
1 parent ce50ab2 commit d80d598
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ haxelib run reflaxe test
| - | ------ | ------ |
| 1 | Install via haxelib git. | <pre>haxelib git reflaxe /~https://github.com/SomeRanDev/reflaxe.git</pre> |
| 2 | Add the lib to your `.hxml` file or compile command. | <pre lang="hxml">-lib reflaxe</pre> |
| 3 | Extend your compiler class from `BaseCompiler`. | <pre lang="haxe">class MyLangCompiler extends reflaxe.BaseCompiler</pre> |
| 3 | Extend your compiler class from `DirectToStringCompiler`. | <pre lang="haxe">class MyLangCompiler extends reflaxe.DirectToStringCompiler</pre> |

&nbsp;
&nbsp;
Expand Down Expand Up @@ -105,10 +105,10 @@ You may add as many paths to the "stdPaths" as you like, and these will be combi
&nbsp;

## Compiler Code Sample
For starters, you must fill out the abstract functions from `BaseCompiler` to define how Haxe AST is converted into a String representation of your target language.
For starters, you must fill out the abstract functions from `DirectToStringCompiler` to define how Haxe AST is converted into a String representation of your target language.

```haxe
class MyLangCompiler extends reflaxe.BaseCompiler {
class MyLangCompiler extends reflaxe.DirectToStringCompiler {
//---------
// fill out just these 3 functions and Reflaxe takes care of the rest
//---------
Expand All @@ -132,7 +132,7 @@ class MyLangCompiler extends reflaxe.BaseCompiler {
&nbsp;

## Compiler Init Code Sample
Reflaxe projects also require an initialization macro call to setup the various properties for your target. While you can add this "Start" function to your `BaseCompiler` class, the standard for Reflaxe projects is to have this code in a separate class:
Reflaxe projects also require an initialization macro call to setup the various properties for your target. While you can add this "Start" function to your compiler class, the standard for Reflaxe projects is to have this code in a separate class:

```haxe
class MyLangCompilerInit {
Expand Down Expand Up @@ -382,13 +382,13 @@ public var deleteOldOutput: Bool = true;
public var ignoreBodilessFunctions: Bool = false;
/**
If `true`, extern classes and fields are not passed to BaseCompiler.
If `true`, extern classes and fields are not passed to `BaseCompiler`.
**/
public var ignoreExterns: Bool = true;
/**
If `true`, properties that are not physical properties
are not passed to BaseCompiler. (i.e. both their
are not passed to `BaseCompiler`. (i.e. both their
read and write rules are "get", "set", or "never").
**/
public var ignoreNonPhysicalFields: Bool = true;
Expand Down
3 changes: 2 additions & 1 deletion newproject/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test/out
_Build/
test/out
4 changes: 2 additions & 2 deletions newproject/src/langcompiler/Compiler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package langcompiler;
import haxe.macro.Type;

// Import Reflaxe types
import reflaxe.PluginCompiler;
import reflaxe.DirectToStringCompiler;
import reflaxe.data.ClassFuncData;
import reflaxe.data.ClassVarData;
import reflaxe.data.EnumOptionData;
Expand All @@ -18,7 +18,7 @@ import reflaxe.data.EnumOptionData;
This must extend from `BaseCompiler`. `PluginCompiler<T>` is a child class
that provides the ability for people to make plugins for your compiler.
**/
class Compiler extends PluginCompiler<Compiler> {
class Compiler extends DirectToStringCompiler {
/**
This is the function from the BaseCompiler to override to compile Haxe classes.
Given the haxe.macro.ClassType and its variables and fields, return the output String.
Expand Down

0 comments on commit d80d598

Please sign in to comment.