fluffos/docs/apply/master/parser_error_message.md

79 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

more doc fixes. (#1137) * docs: Fix multiple documentation issues This commit addresses several documentation inconsistencies and gaps identified by comparing docs with actual code implementations: **Build Documentation Fixes:** - Updated macOS build instructions to clarify Homebrew paths for both Apple Silicon and Intel Macs, emphasizing modern Homebrew defaults - Added clarity to SQLite version options (=1 vs =2) explaining the differences and recommending version 2 **CLI Tool Documentation:** - Added documentation for the `symbol` utility (docs/cli/symbol.md) - Tool for loading and analyzing LPC files - Usage: symbol <config> lpc_file - Added documentation for the `portbind` utility (docs/cli/portbind.md) - Privilege-separated port binding for FluffOS - Allows binding to privileged ports then dropping privileges **Apply Documentation:** - Added mxp_enable apply (docs/apply/interactive/mxp_enable.md) - Called when MXP protocol is negotiated with client - Added mxp_tag apply (docs/apply/interactive/mxp_tag.md) - Processes MXP tags from client - Added zmp_command apply (docs/apply/interactive/zmp.md) - Handles ZMP (Zenith Mud Protocol) commands - Added receive_ed apply (docs/apply/interactive/receive_ed.md) - Post-processes ed editor output - Removed obsolete view_errors.md documentation - Apply not found in source code, appears to be deprecated All new documentation follows existing format conventions and includes cross-references to related efuns and applies where applicable. * docs: Add missing apply and efun documentation This commit adds documentation for previously undocumented applies and efuns, completing the documentation coverage for recent FluffOS features. **Apply Documentation:** - terminal_colour_replace (interactive): Custom color token replacement callback for terminal_colour() efun preprocessing - parser_error_message (master): Custom error message generation for parse_sentence() failures **Efun Documentation:** - hash() (crypto package): Complete documentation for cryptographic hash function with support for modern algorithms (SHA-3, BLAKE2, SM3) - Includes security recommendations and version compatibility notes - Documents all supported algorithms from legacy (MD5, SHA-1) to modern (SHA-3, BLAKE2b512) - Created new crypto package documentation directory **Index Updates:** - Updated docs/apply/interactive/index.md with new applies: mxp_enable, mxp_tag, receive_ed, terminal_colour_replace, zmp - Updated docs/apply/master/index.md with parser_error_message - Removed obsolete view_errors reference from master index - Added crypto section to docs/efun/index.md These additions address documentation gaps identified by comparing the source code with existing documentation, particularly for the crypto package enhancements from commit 33de35c (modern hash algorithms). * docs: Add CLI tool, config guide, and documentation maintenance guide This commit adds comprehensive documentation for additional FluffOS features and creates a maintenance guide for the documentation itself. **New CLI Documentation:** - generate_keywords: Development tool for generating keywords.json for IDE integration and language server support. Extracts all efun metadata into structured JSON format. **New Configuration Documentation:** - config.md (driver/): Complete guide to driver configuration file format - Documents all configuration options with examples - Network setup (telnet, websocket, TLS) - Memory management and performance tuning - Protocol support (GMCP, MXP, ZMP, MSSP, MSP) - Security settings and limits - Includes practical examples for development and production **Documentation Maintenance Guide:** - CLAUDE.md (docs/): Comprehensive guide for maintaining FluffOS documentation - Documentation structure and organization - Templates for applies, efuns, and CLI tools - Workflow for finding and documenting undocumented features - Source code mapping (where to find implementations) - Verification and testing procedures - Common documentation issues and fixes - Package-specific notes and guidelines - Quick reference commands for contributors **Index Updates:** - Updated docs/driver/index.md to include config.md These additions make it easier for contributors and AI assistants to maintain accurate, complete documentation for FluffOS. * docs: Add socket TLS options and LPC default arguments documentation This commit documents important FluffOS features that were previously undocumented, focusing on TLS socket options and LPC language enhancements. **Socket TLS Options Documentation:** - socket_set_option() efun - Configure socket TLS/SSL parameters - SO_TLS_VERIFY_PEER: Control peer certificate verification - SO_TLS_SNI_HOSTNAME: Set Server Name Indication hostname - Includes security notes and practical examples - Essential for HTTPS and secure socket connections - socket_get_option() efun - Query socket option values - Retrieve TLS verification and SNI settings - Useful for validation and debugging - Examples for conditional logic and auditing **LPC Language Feature:** - Default Arguments documentation (prototypes.md) - Comprehensive guide to FluffOS default argument syntax - Feature added in commit bcb8e91 (2023) but not documented - Rules, examples, and use cases - Multiple practical examples showing API design patterns - Notes on compile-time behavior and limitations **Index Updates:** - Updated docs/efun/index.md with new socket functions - Updated docs/efun/sockets/index.md with new functions These features significantly enhance LPC programming capabilities: 1. TLS options enable secure network connections with certificate verification 2. Default arguments reduce code duplication and improve API usability Both features are production-ready and widely used but were missing from the documentation. References: - Socket options: commit 1fd7f61 (2023) - Default arguments: commit bcb8e91 (2023) * docs: Add comprehensive guides for tracing, TLS, and WebSocket support Added three new concept documentation guides: 1. tracing.md - Complete guide to performance profiling with trace_start/trace_end - Chrome DevTools integration - Memory management warnings - Profiling scenarios (commands, combat, heartbeats) - Analysis techniques and best practices 2. tls.md - Comprehensive TLS/SSL support documentation - Server port TLS configuration - Certificate generation (self-signed and Let's Encrypt) - Client TLS socket connections with SO_TLS_VERIFY_PEER and SO_TLS_SNI_HOSTNAME - Security best practices - Troubleshooting guide 3. websocket.md - Complete WebSocket support guide - WebSocket server configuration (ws:// and wss://) - Multiple protocols (ASCII, Telnet, Binary, HTTP) - Built-in web client documentation and customization - GMCP over WebSocket - Telnet protocol over WebSocket - Security considerations and performance optimization - Troubleshooting and advanced usage Updated concepts/general/index.md to include all three new guides. * docs: Regenerate documentation indices Ran update_index.sh to regenerate all documentation indices: - docs/apply/index.md: Added new applies (mxp_enable, mxp_tag, receive_ed, terminal_colour_replace, zmp, parser_error_message), removed obsolete view_errors - docs/concepts/index.md: Added new concept guides (tls, tracing, websocket) - docs/driver/index.md: Added config documentation, updated title format - docs/efun/crypto/index.md: Regenerated to standard format with hash function - docs/cli/index.md: Generated index for CLI tools (driver, generate_keywords, json2o, lpcc, o2json, portbind, symbol) All indices now correctly reference the new documentation added in previous commits. --------- Co-authored-by: Claude <noreply@anthropic.com>
2025-10-31 14:25:38 -07:00
---
title: master / parser_error_message
---
# parser_error_message
### NAME
parser_error_message - generate custom parser error messages
### SYNOPSIS
string parser_error_message(int error_type, object ob, ...) ;
### DESCRIPTION
This apply is called by the parser package when a parsing error occurs,
allowing the mudlib to provide custom error messages for parse_sentence()
failures.
**Arguments:**
- `error_type`: The type of parsing error that occurred
- `ob`: The object that caused the error (may be 0)
- Additional arguments depend on the error type
**Error Types and Arguments:**
- `ERR_IS_NOT` / `ERR_NOT_LIVING` / `ERR_NOT_ACCESSIBLE` (4 arguments):
- `string noun`: The noun that caused the error
- `int is_plural`: 1 if plural, 0 if singular
- `ERR_AMBIG` (3 arguments):
- `object *objects`: Array of ambiguous objects
- `ERR_ORDINAL` (3 arguments):
- `int ordinal`: The problematic ordinal number
- `ERR_THERE_IS_NO` (3 arguments):
- `string phrase`: The problematic word sequence
- `ERR_ALLOCATED` (3 arguments):
- `string message`: An allocated error string
- `ERR_BAD_MULTIPLE` (2 arguments):
- (no additional arguments)
- `ERR_MANY_PATHS` (5 arguments):
- (additional path-related data)
**Return Value:**
- Return a string containing the error message to show to the user
- Return 0 to use default error handling
### EXAMPLE
```c
string parser_error_message(int type, object ob, mixed arg) {
switch(type) {
case ERR_NOT_LIVING:
return "The " + arg + " is not alive.";
case ERR_AMBIG:
return "Which " + file_name(arg[0]) + " do you mean?";
case ERR_THERE_IS_NO:
return "I don't see any '" + arg + "' here.";
default:
return "I don't understand that.";
}
}
```
### SEE ALSO
parse_sentence(3), parse_init(3)
### NOTE
This apply requires the parser package to be enabled. Error type constants
should be defined in your mudlib's include files based on the parser
package implementation.