summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2012-12-30 16:38:18 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2012-12-30 16:38:18 +0100
commitf23c85949f16d4d1e793db5a438adbb900015db1 (patch)
tree404d3e553542eaeb715507ed3554bac5f79de21a
parent46dfa01922bcf20e8a1af7e0041fc620e899d5a6 (diff)
downloadsencha-lang-f23c85949f16d4d1e793db5a438adbb900015db1.tar.gz
sencha-lang-f23c85949f16d4d1e793db5a438adbb900015db1.tar.bz2
sencha-lang-f23c85949f16d4d1e793db5a438adbb900015db1.zip
Some test for function functionality and minor changes in other stuff.
-rw-r--r--Sencha-lang/.cproject139
-rw-r--r--Sencha-lang/Elements/SenchaFunction.cpp2
-rw-r--r--Sencha-lang/Elements/SenchaFunction.h8
-rw-r--r--Sencha-lang/Tests/TestParser.cpp55
-rw-r--r--Sencha-lang/Tests/TestParser.h4
-rw-r--r--Sencha-lang/main.cpp12
6 files changed, 213 insertions, 7 deletions
diff --git a/Sencha-lang/.cproject b/Sencha-lang/.cproject
new file mode 100644
index 0000000..7335ba0
--- /dev/null
+++ b/Sencha-lang/.cproject
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.1544392496">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.1544392496" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.1544392496" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
+ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.1544392496." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.2045041315" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1733237476" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
+ <builder buildPath="${workspace_loc:/Sencha-lang/Debug}" id="cdt.managedbuild.builder.gnu.cross.2091580062" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/>
+ <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1055356392" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.758256537" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.debugging.level.1319397326" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.809384772" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <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" 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"/>
+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1545256246" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1240442083" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.cross.archiver.973026492" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
+ <tool id="cdt.managedbuild.tool.gnu.cross.assembler.1898223694" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.415327363" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry excluding="AST|Tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="AST"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="Tests"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.1985450505">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.1985450505" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.1985450505" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
+ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.1985450505." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.1226114014" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.676474921" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
+ <builder buildPath="${workspace_loc:/Sencha-lang/Release}" id="cdt.managedbuild.builder.gnu.cross.23375219" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
+ <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.671993191" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1104799874" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.debugging.level.1423670337" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1507898701" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.938543294" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
+ <option id="gnu.cpp.compiler.option.optimization.level.491096180" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.debugging.level.1816198684" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.599623873" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1203418436" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.860949532" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.124143498" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1698336651" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
+ <tool id="cdt.managedbuild.tool.gnu.cross.assembler.1350015407" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.949134942" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <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">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1985450505;cdt.managedbuild.config.gnu.cross.exe.release.1985450505.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.938543294;cdt.managedbuild.tool.gnu.cpp.compiler.input.599623873">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1544392496;cdt.managedbuild.config.gnu.cross.exe.debug.1544392496.;cdt.managedbuild.tool.gnu.cross.c.compiler.1055356392;cdt.managedbuild.tool.gnu.c.compiler.input.809384772">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+ </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 &quot;${plugin_state_location}/specs.cpp&quot;" command="g++" useDefault="true"/>
+ <parser enabled="true"/>
+ </scannerInfoProvider>
+ </profile>
+ </scannerConfigBuildInfo>
+ </storageModule>
+</cproject>
diff --git a/Sencha-lang/Elements/SenchaFunction.cpp b/Sencha-lang/Elements/SenchaFunction.cpp
index dfbf428..a18bc27 100644
--- a/Sencha-lang/Elements/SenchaFunction.cpp
+++ b/Sencha-lang/Elements/SenchaFunction.cpp
@@ -7,7 +7,7 @@
#include "SenchaFunction.h"
-SenchaFunction::SenchaFunction(std::string name, std::vector<std::string> names_of_arguments, ASTNode * body, Context * context)
+SenchaFunction::SenchaFunction(std::string name, std::vector<std::string> names_of_arguments, ASTNode * body, ContextManager * context)
: name(name), names_of_arguments(names_of_arguments), body(body), context(context)
{
diff --git a/Sencha-lang/Elements/SenchaFunction.h b/Sencha-lang/Elements/SenchaFunction.h
index 7185ebb..53eb584 100644
--- a/Sencha-lang/Elements/SenchaFunction.h
+++ b/Sencha-lang/Elements/SenchaFunction.h
@@ -10,10 +10,10 @@
#include <string>
#include <iostream>
#include <vector>
-#include <SenchaObject.h>
+#include "SenchaObject.h"
#include "Element.h"
#include "../Utils/to_string.h"
-#include "../Context.h"
+#include "../ContextManager.h"
#include "../AST/ASTNode.h"
@@ -23,9 +23,9 @@ public:
std::string name;
std::vector<std::string> names_of_arguments;
ASTNode * body;
- Context * context;
+ ContextManager * context;
- SenchaFunction(std::string name, std::vector<std::string> names_of_arguments, ASTNode * body, Context * context);
+ SenchaFunction(std::string name, std::vector<std::string> names_of_arguments, ASTNode * body, ContextManager * context);
virtual ~SenchaFunction();
};
diff --git a/Sencha-lang/Tests/TestParser.cpp b/Sencha-lang/Tests/TestParser.cpp
index 6d9d66a..3f58cda 100644
--- a/Sencha-lang/Tests/TestParser.cpp
+++ b/Sencha-lang/Tests/TestParser.cpp
@@ -38,13 +38,64 @@ std::string TestParser::test_parsing_and_evaluating_logical_expressions()
std::string TestParser::test_adding_new_function()
{
std::string test_report = "";
- std::string function_declaration =+ "def print_hello(how_many_times) {";
- function_declaration =+ " repeat(how_many_times) { print(\"Hello\");}";
+ std::string function_declaration = "def print_hello(how_many_times) {";
+ function_declaration += " repeat(how_many_times) { print(\"Hello\");}";
+ ContextManager context;
+ Parser parser(&context);
+ Lexer lexer;
+ auto tokens = lexer.parse_line(function_declaration);
+ parser.add_tokens(tokens);
+ parser.interpret();
return test_report;
}
+std::string TestParser::test_calling_funtion()
+{
+ std::string test_report = "";
+ register_some_functions();
+ std::string call = "print_hello(77);";
+ return test_report;
+}
+
+void TestParser::register_some_functions()
+{
+ std::string print_hello_declaration ="def print_hello(how_many_times) {";
+ print_hello_declaration += " repeat(how_many_times) { print(\"Hello\");}";
+
+ std::string how_long_declaration = "def how_long(some_text) {";
+ how_long_declaration += " return len(some_text);}";
+
+
+ std::string max_declaration = "def max(a, b) { ";
+ max_declaration += "if(a > b) return a;";
+ max_declaration += "else return b; }";
+
+ std::string min_declaration = "def min(a, b) { ";
+ min_declaration += "if(a < b) return a;";
+ min_declaration += "else return b; }";
+
+ std::string multiply_string_declaration = "def multiply_string(text, i) {";
+ multiply_string_declaration += "result = \"\"; ";
+ multiply_string_declaration += "repeats(i) { result = result + text }";
+ multiply_string_declaration += " return result; ";
+
+}
+
+std::vector<TestParser::SInputOutputPair> TestParser::prepare_function_call_input()
+{
+ std::vector<SInputOutputPair> function_calls;
+
+ function_calls.push_back(SInputOutputPair("print_hello(77);", SenchaObject()));
+ function_calls.push_back(SInputOutputPair("how_long(\"elephant\");", SenchaObject(8)));
+ function_calls.push_back(SInputOutputPair("max(77, 12);", SenchaObject(77)));
+ function_calls.push_back(SInputOutputPair("min(12, 1);", SenchaObject(1)));
+ function_calls.push_back(SInputOutputPair("multiply_string(\"alfa\", 3);", SenchaObject("alfaalfaalfa")));
+
+ return function_calls;
+
+}
std::vector<TestParser::InputOutputPair> TestParser::prepare_logical_input()
{
diff --git a/Sencha-lang/Tests/TestParser.h b/Sencha-lang/Tests/TestParser.h
index 37e9d87..10157ce 100644
--- a/Sencha-lang/Tests/TestParser.h
+++ b/Sencha-lang/Tests/TestParser.h
@@ -22,10 +22,14 @@ public:
TestParser();
virtual ~TestParser();
typedef std::pair<std::string, bool> InputOutputPair;
+ typedef std::pair<std::string, SenchaObject> SInputOutputPair;
private:
std::string test_parsing_and_evaluating_logical_expressions();
std::string test_adding_new_function();
+ std::string test_calling_funtion();
+ void register_some_functions();
std::vector<InputOutputPair> prepare_logical_input();
+ std::vector<TestParser::SInputOutputPair> prepare_function_call_input();
virtual std::string all_tests();
diff --git a/Sencha-lang/main.cpp b/Sencha-lang/main.cpp
index 07fd038..d2e9848 100644
--- a/Sencha-lang/main.cpp
+++ b/Sencha-lang/main.cpp
@@ -118,6 +118,16 @@ SenchaObject s_tan(vector<ASTExpression *> arguments)
return result;
}
+SenchaObject len(vector<ASTExpression *> arguments)
+{
+ SenchaObject result;
+ SenchaObject argument = arguments[0]->evaluate();
+ if(argument.type == SenchaObject::string_literal)
+ {
+ result = SenchaObject(int(argument.text.size()));
+ }
+ return result;
+}
int how_depth_change(vector<Token> tokens)
@@ -151,6 +161,7 @@ void interactive()
context.register_function("cos", s_cos);
context.register_function("tan", s_tan);
context.register_function("sleep", sleep);
+ context.register_function("len", len);
Parser parser(&context);
ASTInspector inspector;
@@ -205,6 +216,7 @@ int main(int argc, char *argv[])
context.register_function("cos", s_cos);
context.register_function("tan", s_tan);
context.register_function("sleep", sleep);
+ context.register_function("len", len);
Parser parser(&context);