fot

command module
v0.0.0-...-78131e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

fot

fast out template

/* 类型系统设计

类型声明:

基础数据类型 int float string 复合数据类型 array * map uint:int 特殊数据类型 enum ! union | ref ! impl ~ dep

数据结构:

声明类型 type DecType struct {

} 类型生成时会完成依赖关联 解析实例化时会转成模板系统的struct。

ddata

index 索引类型 ref声明在解析实例化时生成 用于依赖检查和配置合并的数据实体

*/

/* 模板系统设计

$$ 当前变量 :type 数据类型 :name 变量名字 默认 enum,struct, struct.filed 都有 :desc 描述 struct.filed 从声明取 enum从数据取 :ext 扩展信息 struct.filed :fixed 固定大小 array

指令: @if @else @end @for @end @iflast @format @let */

/* 整体设计

参数: -t 外部模板文件目录 -d 外部数据文件目录 execl 文件目录 -o 输出的sheet,默认全部输出

执行流程: 1.解析所有外部模板文件 生成解析器 2.解析execl文件的类型行生成dtype 3.通过dtype生成依赖图DAG 4.通过依赖图生成分层数组Levels 5.通过levels逐层的解析execl文件 6.解析execl文件逐行扫描数据通过dtype做类型检查或数据引用合并,目标是生成struct。 此过程赋予field :name :type 等元数据 最终生成赋予此struct :name为execl文件名字 7.通过struct生成子级依赖的index数据 8.解析完execl文件的数据生成模板系统的array,赋予此array :name为execl文件名字 9.对array并发进行模板解析生成最终数据

*/

@temple erlang_module_config

@if $$:type == chunk -module($$:name).

-export([ gets/0, get/1 ]).

-include("config.hrl").

gets() -> [@format %pa.id $.].

@let $rown = 0 @for $row := $$ @if $row:type == struct $rown = $rown + 1 get($row.id) -> #$row:name { @for $filed := $row $filed:name = @format %t.erlang $filed @iflast '' , @end }; @end @end @if $rown > 0 get(_) -> undef. @end

@end

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
di
internal
template
Package template implements data-driven templates for generating textual output.
Package template implements data-driven templates for generating textual output.
template/parse
Package parse builds parse trees for templates as defined by text/template and html/template.
Package parse builds parse trees for templates as defined by text/template and html/template.
reader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL