Documentation
¶
Overview ¶
pkg/server/server.go HTTP/HTTPS server implementation for Xxlang.
pkg/server/xhp.go XHP (Xxlang HTML Processor) implementation using Eval mode for segment-by-segment execution
Index ¶
- Constants
- func CreateXHPInterpreter(scriptPath string, res http.ResponseWriter, req *http.Request, ...) (*interpreter.Interpreter, error)
- func ExecuteXHPSegments(segments []XHPSegment, interp *interpreter.Interpreter) (string, error)
- func ProcessXHP(content, scriptPath string, res http.ResponseWriter, req *http.Request, ...) (string, error)
- func RunScriptOnHttp(code, scriptPath string, res http.ResponseWriter, req *http.Request, ...) (string, error)
- type Config
- type Server
- type XHPProcessor
- type XHPSegment
- type XHPSegmentType
Constants ¶
const ( XHPStartTag = "<?xhp" XHPEndTag = "?>" )
XHP tag markers
const EndResponseMarker = "TX_END_RESPONSE_XT"
EndResponseMarker is returned by scripts to signal that the response is complete
Variables ¶
This section is empty.
Functions ¶
func CreateXHPInterpreter ¶
func CreateXHPInterpreter(scriptPath string, res http.ResponseWriter, req *http.Request, paraMap map[string]string, globals map[string]interface{}) (*interpreter.Interpreter, error)
CreateXHPInterpreter creates an interpreter configured for XHP execution
func ExecuteXHPSegments ¶
func ExecuteXHPSegments(segments []XHPSegment, interp *interpreter.Interpreter) (string, error)
ExecuteXHPSegments executes parsed XHP segments using Eval mode
func ProcessXHP ¶
func ProcessXHP(content, scriptPath string, res http.ResponseWriter, req *http.Request, paraMap map[string]string, globals map[string]interface{}) (string, error)
ProcessXHP processes an XHP file using Eval mode for segment-by-segment execution XHP files contain HTML with <?xhp ... ?> code blocks that are executed All code blocks in the same XHP file share the same context (variables) return statements output their values, echo() function also outputs
Types ¶
type Config ¶
type Config struct {
HTTPPort int `json:"httpPort"`
HTTPSPort int `json:"httpsPort"`
WebPath string `json:"webPath"`
MSPath string `json:"msPath"`
CertPath string `json:"certPath"`
}
Config holds server configuration
func LoadConfig ¶
LoadConfig loads server configuration from a JSON file
type XHPProcessor ¶
type XHPProcessor struct {
// contains filtered or unexported fields
}
XHPProcessor handles XHP template processing with Eval mode execution
func NewXHPProcessor ¶
func NewXHPProcessor(scriptPath string, res http.ResponseWriter, req *http.Request, paraMap map[string]string, globals map[string]interface{}) *XHPProcessor
NewXHPProcessor creates a new XHP processor
func (*XHPProcessor) GetInterpreter ¶
func (p *XHPProcessor) GetInterpreter() *interpreter.Interpreter
GetInterpreter returns the interpreter for direct access
func (*XHPProcessor) GetSymbolTable ¶
func (p *XHPProcessor) GetSymbolTable() *compiler.SymbolTable
GetSymbolTable returns the symbol table for XHP processing
type XHPSegment ¶
type XHPSegment struct {
Type XHPSegmentType // HTML or Code
Content string // Raw content
Position int // Position in source
}
XHPSegment represents a parsed segment from XHP content
func ParseXHP ¶
func ParseXHP(content string) ([]XHPSegment, error)
ParseXHP parses XHP content into segments
type XHPSegmentType ¶
type XHPSegmentType int
const ( XHPSegmentHTML XHPSegmentType = iota XHPSegmentCode )