Skip to content

Commit

Permalink
python syntax; needs work
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaughan committed Oct 4, 2023
1 parent 25e6582 commit ba07afd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/syntax_providers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ static std::unordered_set<std::string> scenegraph_keywords = {
"pass", "post_2d", "geometry", "camera", "position", "look_at", "field_of_view", "near_far", "build_as", "vs", "gs", "fs", "model", "scale", "path", "surface", "size", "format", "targets", "clear", "ray_group_triangles", "ray_group_general", "ray_group_procedural", "ray_gen", "closest_hit", "miss", "any_hit", "callable", "intersection"
};

static std::unordered_set<std::string> py_keywords = {
"for", "in", "fn", "def", "range", "import", "from", "int", "float", "vec2", "vec4", "vec3"
};

static std::unordered_set<std::string> py_identifiers = {
"math", "sin", "cos", "circle", "bezier", "line", "text"
};

static std::unordered_set<std::string> scenegraph_identifiers = {
":", "=", "default", "default_color", "default_depth", "screen_rect"
};
Expand Down Expand Up @@ -198,6 +206,12 @@ void RegisterSyntaxProviders(ZepEditor& editor)
SyntaxProvider{ "markdown", tSyntaxFactory([](ZepBuffer* pBuffer) {
return std::make_shared<ZepSyntax_Markdown>(*pBuffer, markdown_keywords, markdown_identifiers, ZepSyntaxFlags::CaseInsensitive);
}) });

editor.RegisterSyntaxFactory(
{ ".py", ".python" },
SyntaxProvider{ "python", tSyntaxFactory([](ZepBuffer* pBuffer) {
return std::make_shared<ZepSyntax>(*pBuffer, py_keywords, py_identifiers, ZepSyntaxFlags::CaseInsensitive);
}) });
}

} // namespace Zep

0 comments on commit ba07afd

Please sign in to comment.