I was having fun with oxygen trying to do some documentation.
parent
b9d9788da2
commit
c00e4e3e16
|
@ -27,7 +27,7 @@
|
|||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.495732557" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.793014755" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.1513381051" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.other.other.335578218" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=gnu++0x " valueType="string"/>
|
||||
<option id="gnu.cpp.compiler.option.other.other.335578218" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=gnu++0x " valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.859439950" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.693029150" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
|
@ -101,6 +101,16 @@
|
|||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Sencha-lang.cdt.managedbuild.target.gnu.cross.exe.1970449863" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/Sencha-lang"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/Sencha-lang"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1985450505;cdt.managedbuild.config.gnu.cross.exe.release.1985450505.;cdt.managedbuild.tool.gnu.cross.c.compiler.671993191;cdt.managedbuild.tool.gnu.c.compiler.input.1507898701">
|
||||
|
@ -114,16 +124,16 @@
|
|||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1544392496;cdt.managedbuild.config.gnu.cross.exe.debug.1544392496.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.495732557;cdt.managedbuild.tool.gnu.cpp.compiler.input.859439950">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -g -v -dD "${plugin_state_location}/specs.cpp"" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/Sencha-lang"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/Sencha-lang"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#include "ConstantExpression.h"
|
||||
|
||||
ConstantExpression::ConstantExpression(ASTNode * parent) {
|
||||
ConstantExpression::ConstantExpression(ASTNode * parent) //Constructor which sets value to null SenchaObject.
|
||||
{
|
||||
this->parent = parent;
|
||||
value = SenchaObject();
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ void ConstantExpression::execute_quietly()
|
|||
evaluate();
|
||||
}
|
||||
|
||||
|
||||
/*! \fn Constructor which creates SenchaObject(number) and sets value to it */
|
||||
ConstantExpression::ConstantExpression(ASTNode * parent, int number)
|
||||
{
|
||||
this->parent = parent; value = SenchaObject(number);
|
||||
|
|
|
@ -11,22 +11,69 @@
|
|||
#include <iostream>
|
||||
#include "../Context.h"
|
||||
|
||||
/**
|
||||
* ConstantExpression class is used to store complex expression, which are actually
|
||||
* SenchaObjects. Constant Expressions are made in parser when it encounter some of primitives
|
||||
* like string literal or numbers, they also can be made on already made SenchaObject.
|
||||
* ConstantExpression is a part of AST, so it must have parent. It's a node in which it is build.
|
||||
* It implements four virtual functions: debug, evaluate, execute_quietly.
|
||||
* It stores the value of expression.
|
||||
*/
|
||||
class ConstantExpression : public ASTExpression {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor which sets value to null SenchaObject.o it
|
||||
* @param parent of the ConstantExpression node
|
||||
* @param number value will be set to SenchaObject representing this number
|
||||
*/
|
||||
ConstantExpression(ASTNode * parent);
|
||||
|
||||
|
||||
/**
|
||||
*Constructor which creates SenchaObject(number) and sets value to it
|
||||
* @param parent of the ConstantExpression node
|
||||
* @param number value will be set to SenchaObject representing this number
|
||||
*/
|
||||
ConstantExpression(ASTNode * parent, int number) ;
|
||||
|
||||
/**
|
||||
* Constructor which creates SenchaObject(number) and sets value to it
|
||||
* @param parent of the ConstantExpression node
|
||||
* @param number value will be set to SenchaObject representing this number
|
||||
*/
|
||||
ConstantExpression(ASTNode * parent, double number) ;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor which creates SenchaObject(text) and sets value to it
|
||||
* @param parent of the ConstantExpression node
|
||||
* @param text value will be set to SenchaObject representing this text
|
||||
*/
|
||||
ConstantExpression(ASTNode * parent, std::string text);
|
||||
|
||||
/**
|
||||
* Constructor which sets value to given value
|
||||
* @param parent of the ConstantExpression node
|
||||
* @param value this->value will be set to value
|
||||
*/
|
||||
ConstantExpression(ASTNode * parent, SenchaObject value);
|
||||
|
||||
/** Here's value of constant expression */
|
||||
SenchaObject value;
|
||||
|
||||
/** Provides some useful information */
|
||||
std::string debug();
|
||||
|
||||
|
||||
virtual ~ConstantExpression();
|
||||
|
||||
/**Returns value set in one of constructors */
|
||||
virtual SenchaObject evaluate();
|
||||
|
||||
/**Prints representation of value */
|
||||
virtual void execute() ;
|
||||
|
||||
/**Does nothing */
|
||||
virtual void execute_quietly() ;
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
|||
<!-- start footer part -->
|
||||
<!--BEGIN GENERATE_TREEVIEW-->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
$navpath
|
||||
<li class="footer">$generatedby
|
||||
<a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--END GENERATE_TREEVIEW-->
|
||||
<!--BEGIN !GENERATE_TREEVIEW-->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
$generatedby  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/>
|
||||
</a> $doxygenversion
|
||||
</small></address>
|
||||
<!--END !GENERATE_TREEVIEW-->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="$relpath$jquery.js"></script>
|
||||
<script type="text/javascript" src="$relpath$dynsections.js"></script>
|
||||
$treeview
|
||||
$search
|
||||
$mathjax
|
||||
<link href="$relpath$$stylesheet" rel="stylesheet" type="text/css" />
|
||||
$extrastylesheet
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
|
||||
<!--BEGIN TITLEAREA-->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<!--BEGIN PROJECT_LOGO-->
|
||||
<td id="projectlogo"><img alt="Logo" src="$relpath$$projectlogo"/></td>
|
||||
<!--END PROJECT_LOGO-->
|
||||
<!--BEGIN PROJECT_NAME-->
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">$projectname
|
||||
<!--BEGIN PROJECT_NUMBER--> <span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
|
||||
</div>
|
||||
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
|
||||
</td>
|
||||
<!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME-->
|
||||
<!--BEGIN PROJECT_BRIEF-->
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectbrief">$projectbrief</div>
|
||||
</td>
|
||||
<!--END PROJECT_BRIEF-->
|
||||
<!--END !PROJECT_NAME-->
|
||||
<!--BEGIN DISABLE_INDEX-->
|
||||
<!--BEGIN SEARCHENGINE-->
|
||||
<td>$searchbox</td>
|
||||
<!--END SEARCHENGINE-->
|
||||
<!--END DISABLE_INDEX-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--END TITLEAREA-->
|
||||
<!-- end header part -->
|
|
@ -206,46 +206,46 @@ void interactive()
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(argc <= 1)
|
||||
{
|
||||
//TestLexer test_l;
|
||||
//test_l.run_tests();
|
||||
|
||||
|
||||
//test_parser();
|
||||
//test_lexer();
|
||||
cout << "Sencha-lang interpreter, version 0.12" << endl;
|
||||
interactive();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto name = argv[1];
|
||||
Lexer lexer;
|
||||
Context context;
|
||||
context.register_function("print", print);
|
||||
context.register_function("sin", s_sin);
|
||||
context.register_function("cos", s_cos);
|
||||
context.register_function("tan", s_tan);
|
||||
|
||||
Parser parser(&context);
|
||||
vector<Token> tokens;
|
||||
string line;
|
||||
ifstream input_file (name);
|
||||
|
||||
if (input_file.is_open())
|
||||
{
|
||||
while ( input_file.good() )
|
||||
{
|
||||
getline (input_file,line);
|
||||
tokens = lexer.parse_line(line);
|
||||
parser.add_tokens(tokens);
|
||||
}
|
||||
input_file.close();
|
||||
}
|
||||
|
||||
parser.interpret();
|
||||
parser.program->execute();
|
||||
}
|
||||
|
||||
cout << "Sencha-lang interpreter, version 0.12" << endl;
|
||||
if(argc <= 1)
|
||||
{
|
||||
//TestLexer test_l;
|
||||
//test_l.run_tests();
|
||||
|
||||
//test_parser();
|
||||
//test_lexer();
|
||||
interactive();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto name = argv[1];
|
||||
Lexer lexer;
|
||||
Context context;
|
||||
context.register_function("print", print);
|
||||
context.register_function("sin", s_sin);
|
||||
context.register_function("cos", s_cos);
|
||||
context.register_function("tan", s_tan);
|
||||
|
||||
Parser parser(&context);
|
||||
vector<Token> tokens;
|
||||
string line;
|
||||
ifstream input_file (name);
|
||||
|
||||
if (input_file.is_open())
|
||||
{
|
||||
while ( input_file.good() )
|
||||
{
|
||||
getline (input_file,line);
|
||||
tokens = lexer.parse_line(line);
|
||||
parser.add_tokens(tokens);
|
||||
}
|
||||
input_file.close();
|
||||
}
|
||||
|
||||
parser.interpret();
|
||||
parser.program->execute();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue