parser

package
v0.0.0-...-a214d60 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package parser提供创建ast树的简便方法

parser不对代码编译的报误进行处理

如果要进行错误处理请自行使用 pkg/gitee.com/u-language/u-language/ucom/errcode.Handle

Index

Constants

This section is empty.

Variables

View Source
var Debug = false
View Source
var FileNoExt = errors.New("文件没有扩展名")

缩写 File does not have an extension 缩写成 FileNoExt

View Source
var ImportLimit = errors.New("目前import只支持相对路径导入")
View Source
var NoUFileErr = errors.New("没有U文件")
View Source
var PathNotFound = errors.New("找不到的路径")

Functions

func ParserAuto

func ParserAuto(path string, thread bool, errctx *errcode.ErrCtx) (ast.GetImport, error)

ParserAuto 根据path是目录还是文件决定调用 ParserPackageParserFile

func ParserAuto2

func ParserAuto2(path string, thread bool, errctx *errcode.ErrCtx) (ir2.Ir2, error)

ParserAuto2 根据path是目录还是文件决定调用 [ParserPackag2e] 或 ParserFile2

func ParserFile

func ParserFile(path string, errctx *errcode.ErrCtx, IsCheck bool, ImportPackage *map[string]*ast.Package, Thread bool) (*ast.Tree, error)

ParserFile 从一个代码文件创建ast树

  • path是文件路径
  • errctx是错误处理上下文
  • IsCheck是控制是否进行语义检查
  • Thread是控制是否并发

func ParserFile2

func ParserFile2(path string, errctx *errcode.ErrCtx, IsCheck bool, Thread bool) (*ir2.File, error)

ParserFile2 从一个代码文件创建 ir2.File 的指针

  • path是文件路径
  • errctx是错误处理上下文
  • IsCheck是控制是否进行语义检查
  • Thread是控制是否并发

func ParserPackage

func ParserPackage(dir string, thread bool, errctx *errcode.ErrCtx, sbt *ast.Sbt, ImportPackage *map[string]*ast.Package) (*ast.Package, error)

ParserPackage 转换一个目录下所有扩展名为.u的源代码文件为抽象语法树

Types

This section is empty.

Jump to

Keyboard shortcuts

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