Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/parser #17

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/classes/classes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:cs2dart/src/abstractions/abstraction.dart';

abstract class Class implements Abstraction {

}
47 changes: 33 additions & 14 deletions lib/src/lexer/lexer.dart
Original file line number Diff line number Diff line change
@@ -246,6 +246,7 @@ class Lexer {
char == 41 || // right parenthesis
char == 42 || // asterisk
char == 43 || // plus sign
char == 44 || // comma
char == 45 || // hyphen-minus
char == 46 || // full stop, period
char == 47 || // slash
@@ -261,8 +262,9 @@ class Lexer {
char == 123 || // left curly bracket
char == 124 || // vertical bar
char == 125 || // right curly bracket
char == 126) { // tilde
char == 126 ) { // tilde
return true;

}
return false;
}
@@ -493,6 +495,10 @@ class Lexer {

// go through on all of these different types of characters
if (_isOperatorOrPunctuator(_current)) {
// if(_current == 0){
// _next();
// return OperatorOrPunctuatorToken('.');
// }
_next();
if (_isDoubleOp(_current)) {
_next();
@@ -547,45 +553,58 @@ class Lexer {
_next();
if (_isSign(_current)) {
_next();
if (_isRealTypeSuffix(_current)) {
_next();
}
}
if (_isRealTypeSuffix(_current)) {
_next();
// if (_isRealTypeSuffix(_current)) {
// _next();
// }
}
// if (_isRealTypeSuffix(_current)) {
// _next();
// }
}

}
if (_isRealTypeSuffix(_current)) {
_next();
}
// form: XXX'.'XXX
end = _position;
chunk = _text.substring(start, end);
return RealLiteralToken(chunk);
} else if (_isDecimalPoint(_current)) {

_next();
//copied from while loop above
while (lexer_assist.isDecimalDigit(_current)) {
if(lexer_assist.isDecimalDigit(_current))
{
_next();
while (lexer_assist.isDecimalDigit(_current)) {
_next();
if (_isExponentPart(_current)) {
_next();
if (_isSign(_current)) {
_next();
if (_isRealTypeSuffix(_current)) {
_next();
}
}
if (_isRealTypeSuffix(_current)) {
_next();
}
}
}
if (_isRealTypeSuffix(_current)) {
_next();
}
// form: '.'XXX
end = _position;
chunk = _text.substring(start, end);
return RealLiteralToken(chunk);
}
else{
//decrement next

_position = start;
return null;
}
} else {
// not recognized
// reset position
_position = start;

return null;
}
}
Loading