5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 14:41:29 +08:00
wails/v3/internal/parser/README.md
Lea Anthony ecc1791420 Support bound variables (struct literals)
Factor out unaryexpression parsing
Fix package bleed between tests
2023-02-25 09:47:50 +11:00

1.6 KiB

Parser

This package contains the static analyser used for parsing Wails projects so that we may:

  • Generate the bindings for the frontend
  • Generate Typescript definitions for the structs used by the bindings

Implemented

  • Bound types

    • Struct Literal Pointer
    • Variable
      • Assignment
        • Struct Literal Pointer
        • Function
    • Function
  • Parsing of bound methods

    • Method names
    • Method parameters
      • Zero parameters
      • Single input parameter
      • Single output parameter
      • Multiple input parameters
      • Multiple output parameters
      • Named output parameters
      • int/8/16/32/64
        • Pointer
      • uint/8/16/32/64
        • Pointer
      • float
        • Pointer
      • string
        • Pointer
      • bool
        • Pointer
      • Struct
        • Pointer
      • Slices
        • Pointer
      • Maps
        • Pointer
  • Model Parsing

    • In same package
    • In different package
    • Multiple named fields, e.g. one,two,three string
    • Scalars
    • Arrays
    • Maps
    • Structs
      • Recursive
      • Anonymous
  • Generation of models

    • Scalars
    • Arrays
    • Maps
    • Structs
  • Generation of bindings

Limitations

There are many ways to write a Go program so there are many program structures that we would need to support. This is a work in progress and will be improved over time. The current limitations are:

  • The call to application.New() must be in the main package
  • Bound structs must be declared as struct literals