Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolCodegen ¶
type BoolCodegen interface { // RenderVal renders the value of the boolean // // Hulo: // let a = true // let b = false // // Target code: // a=1 // b=0 RenderVal(node hast.Expr) (bast.Node, error) // RenderExpr renders the expression of the boolean // // Hulo: // if true { // echo "this is true" // } else { // echo "this is false" // } // // Target code: // if [ "1" = "1" ]; then // echo "this is true" // else // echo "this is false" // fi RenderExpr(node hast.Expr) (bast.Node, error) }
BoolCodegen is the interface for the boolean codegen
type BooleanAsCommandStrategy ¶
type BooleanAsCommandStrategy struct{}
func (*BooleanAsCommandStrategy) Name ¶
func (s *BooleanAsCommandStrategy) Name() string
type BooleanAsNumberStrategy ¶
type BooleanAsNumberStrategy struct{}
func (*BooleanAsNumberStrategy) Name ¶
func (s *BooleanAsNumberStrategy) Name() string
*
- Transform boolean to number *
- If the boolean is true, it will be transformed to number 1, otherwise it will be transformed to number 0 *
- For example: * *
- if [ "$a" = "b" ]; then
- echo "a is b"
- else
- echo "a is not b"
- fi * *
type BooleanAsStringStrategy ¶
type BooleanAsStringStrategy struct{}
BooleanAsStringStrategy converts boolean values to strings
If the boolean value is true, it will be converted to the string "true", otherwise it will be converted to the string "false"
Example:
if [ "$a" = "true" ]; then echo "a is true" else echo "a is false" fi
func (*BooleanAsStringStrategy) Name ¶
func (s *BooleanAsStringStrategy) Name() string
type NumberBoolEncoder ¶
type NumberBoolEncoder struct{}
Click to show internal directories.
Click to hide internal directories.