Skip to content

Commit

Permalink
D... WHAT THE FUCK
Browse files Browse the repository at this point in the history
  • Loading branch information
HeronErin committed Apr 23, 2024
1 parent 4ca6591 commit 3f06882
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
45 changes: 29 additions & 16 deletions source/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,35 @@ import parsing.tokenizer.make_tokens;

void main()
{
Token[] tokens = tokenizeText("
int x, y;
x = 5;
y = 1;
x = 3;
void x, y;
int tv = x++ + y;
float floaty = tv / 2;
int xx;
int xxx;
");
import tern.typecons.common : Nullable, nullable;
// Token[] tokens = tokenizeText("
// int x, y;
// x = 5;
// y = 1;
// x = 3;
// void x, y;
// int tv = x++ + y;
// float floaty = tv / 2;
// int xx;
// int xxx;
// ");
// import tern.typecons.common : Nullable, nullable;
// import parsing.treegen.scopeParser;
// import parsing.tokenizer.make_tokens;
// size_t index = 0;
// auto scope_ = tokens.parseMultilineScope(index, nullable!ScopeData(null));
// import std.stdio;
// scope_.declaredVariables.writeln;
import parsing.tokenizer.make_tokens;
import parsing.treegen.scopeParser;
import parsing.tokenizer.make_tokens;
size_t index = 0;
auto scope_ = tokens.parseMultilineScope(index, nullable!ScopeData(null));
import std.stdio;
scope_.declaredVariables.writeln;

size_t index = 0;
auto scopeData = new ScopeData;
parseLine("int x, y, z = 4*5+2;".tokenizeText, index, scopeData);

"PTR:".writeln;
(cast(size_t)scopeData.declaredVariables[0].name.names[0].ptr).writeln;

// THIS IS A dchar[] !!!!! WTF
(cast(size_t)scopeData.declaredVariables[0].name.names[0].ptr == 1).writeln;
}
8 changes: 7 additions & 1 deletion source/parsing/treegen/treeGenUtils.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ NameUnit genNameUnit(Token[] tokens, ref size_t index)
.Period)
{

if (token.tokenVariety != TokenType.Period)
if (token.tokenVariety != TokenType.Period){
// dchar[] dataCopy = new dchar[token.value.length];
// dataCopy[0..$] = token.value;
// import std.stdio;
// token.value.writeln;
// dataCopy.ptr.writeln;
nameData ~= token.value;
}

Nullable!Token tokenNullable2 = tokens.nextToken(index);

Expand Down

0 comments on commit 3f06882

Please sign in to comment.