17 个仓库
Identifying code fragments using a combination of literals, regular expressions, and flexible AST bindings.
Distinct from Text Pattern Matching: Distinct from simple text search or binary matching; it operates on the structure of source code.
Explore 17 awesome GitHub repositories matching programming languages & runtimes · Structural Pattern Matching. Refine with filters or upvote what's useful.
xi-editor is a high-performance text editor core written in Rust. It employs a client-server architecture that separates the backend editor logic from the user interface, allowing diverse frontends to communicate with the core via a standardized protocol. The project is distinguished by its use of rope-based text buffers for efficient manipulation of large documents and a collaborative engine powered by conflict-free replicated data types to synchronize concurrent edits. It further features an extensible plugin system that integrates external binaries and third-party tools through JSON-based
Employs non-commutative monoids to track nesting balance for fast identification of matching parentheses and brackets.
Reason is a strongly typed functional language and multi-target compiler designed to produce either JavaScript for web environments or native machine code for operating systems. It serves as an OCaml-compatible language that shares an abstract syntax tree with OCaml, providing a practical syntax for the OCaml ecosystem. The project functions as a type-safe frontend language, incorporating JSX support to build user interfaces through structural elements that translate into type-safe function calls. It enables deep integration with the JavaScript ecosystem, allowing the use of existing librarie
Ships powerful structural pattern matching to execute conditional logic based on data shapes.
emmet-vim is a plugin for Vim that functions as a markup automation tool and code expander. It allows for the rapid generation of HTML and CSS structures by expanding shorthand text expressions into full code elements. The tool provides a set of shortcuts for wrapping, balancing, and manipulating tags. It includes a text object extension that enables navigation and editing commands for jumping between nested element boundaries. The project covers a range of capabilities for frontend code refactoring and document hierarchy restructuring. These include tag wrapping, element removal, attribute
Enables moving the cursor across element boundaries to navigate and edit nested structures quickly.
attrs is a Python library that automatically generates initialization, representation, equality, hashing, and ordering methods from declarative class attribute definitions. At its core, it provides a class decorator metaprogramming framework that intercepts class creation to rewrite the class body, producing dunder methods without manual boilerplate. The library includes a comprehensive attribute validation toolkit with built-in validators for type checks, range constraints, regex matching, length limits, and logical composition of validation rules. The library distinguishes itself through it
Generates match arguments to enable structural pattern matching on instances in Python 3.10+.
This is a TC39 proposal to add declarative pattern matching syntax to the ECMAScript language. It introduces a match expression that allows developers to inspect and branch on data structures using patterns with destructuring, guards, and logical combinators. The proposal defines a custom matcher protocol via a well-known symbol, enabling objects to implement user-defined matching logic with arbitrary extraction and decomposition. The proposal supports matching against literal primitives using SameValue equality with special handling for signed zero and NaN, as well as relational comparison
Extends language grammar with a match expression that destructures values against nested patterns declaratively.
Scala.js 是一个编译器和跨平台语言工具链,将 Scala 源代码转换为 JavaScript 或 WebAssembly。它作为 JavaScript 生态系统的一种静态类型工具,支持为 Web 浏览器和 Node.js 环境开发应用程序。 该项目作为一个 JavaScript 互操作框架,允许创建类型安全的门面(facades)和绑定,以与外部库和全局对象进行交互。它提供了静态和动态 JavaScript 调用机制,包括生成 TypeScript 绑定以及导出内部逻辑以供外部 JavaScript 代码使用的能力。 该工具链包含一个用于生产环境打包和输出优化的前端构建工具,包括死代码消除和模块拆分。它涵盖了广泛的功能面,包括用于 UI 开发的 DOM 元素类型检查、用于全栈开发的跨平台代码共享,以及用于验证优化构建产物的各种测试框架。 编译后的脚本可以使用 JavaScript 解释器直接在命令行环境中执行。
Extracts values from nested data structures using pattern matching to replace traditional conditional logic.
Vis 是一个基于终端的模态文本编辑器,利用 vi 键绑定和结构化正则表达式系统。它作为一个可脚本化的环境,使用 Lua 进行配置、自定义键映射和插件开发。 该编辑器的特色在于基于解析表达式语法 (PEG) 的语法高亮系统,以及将文本视为复杂搜索和替换操作结构的模式匹配引擎。它还直接与系统 Shell 集成,允许用户将文本范围通过管道传输到外部命令并捕获输出结果。 该项目提供了广泛的文本操作功能,包括使用多个光标和选区、用于非线性撤销和重做历史的定向图,以及通过 VT-100 转义序列渲染的多窗口界面。用户可以通过嵌入式脚本 API 定义自定义动作和运算符。 该应用可编译为单个静态链接的二进制文件,以实现可移植性。
Identifies text ranges using extended regular expressions to target specific patterns for commands.
c2rust is a source-to-source translation suite and C-to-Rust transpiler designed to convert C source code and libraries into functionally equivalent unsafe Rust code. It operates as a pipeline that preserves original behavior and data structures, producing translated code that compiles as compatible shared libraries or Rust crates. The system includes an automated Rust refactoring framework that uses pattern-based AST rewriting to transform unsafe Rust into safe, idiomatic constructs. It utilizes an ownership inference engine to determine when raw pointers can be converted into safe reference
Parses pattern strings into syntax fragments and matches them against source code to extract transformation bindings.
Sugar 是一个 JavaScript 实用程序库,旨在通过额外的方法扩展原生对象和原型,以进行数据操作和转换。它作为一个工具包,用于对象实用程序、日期操作、字符串变形以及缺失或损坏的标准语言功能的 Polyfill。 该库提供了将实用方法直接映射到内置原型或将值包装在临时对象中以实现方法链的能力,而无需修改全局原型。它还包括一个 Polyfill 系统,通过实现缺失的现代语言功能来确保跨不同执行环境的一致行为。 功能包括国际日期格式化和人类可读日期字符串的解析。该库还通过字符串变形和规范化、嵌套对象的深度属性遍历以及区域感知数组排序来处理自然语言处理。此外,它还提供了用于克隆可变对象以及定义数字、日期和字符串值范围的工具。
Simplifies array element matching using strings, regular expressions, or partial object shortcuts.
GritQL is an AST-based code transformation engine and structural search tool. It uses a declarative query language to identify and rewrite source code patterns across multiple programming languages by matching abstract syntax tree nodes rather than literal text. The system functions as an automated refactoring framework for large-scale migrations and API updates. It distinguishes itself by utilizing sequential transformation pipelines and reusable blueprints that can be synced between local environments and remote repositories. The tool covers a broad range of capabilities including static a
Restricts a pattern's matches to nodes that satisfy additional structural conditions like parent or sibling relationships.
Codemod 是一套用于执行结构化源代码转换的软件工具。它作为一个自动化代码库迁移工具,利用抽象语法树操作而非简单的正则表达式,在多个文件之间执行大规模重构。 该项目通过一个提供彩色差异的交互式转换界面脱颖而出,允许用户手动审查、接受或修改每个匹配项。它还支持分布式重构工作流,能够将代码库分割成指定的任务块,以便在多个贡献者之间分配迁移任务。 该工具集涵盖了脚本化转换逻辑、模式匹配搜索引擎以及基于扩展的文件过滤功能,以将操作限制在项目的特定子集中。
Identifies specific code fragments using structural pattern matching based on AST bindings and regular expressions.
Memgraph is an in-memory, distributed graph database designed for high-performance labeled property graph management. It utilizes a Cypher query engine for declarative data retrieval and manipulation, providing a scalable knowledge graph backend that integrates vector search and graph traversals. The system distinguishes itself as a real-time graph analytics platform, employing native C++ and CUDA implementations to execute complex network analysis and dynamic community detection on streaming data. It provides specialized support for AI integration, including GraphRAG capabilities, the constr
Retrieves nodes and relationships that match structural patterns, labels, or paths.
FluentAssertions is a library of extension methods for .NET that provides a human-readable syntax for verifying expectations in unit tests. It serves as a validation layer that integrates with MSTest, NUnit, and xUnit to throw framework-specific exceptions upon assertion failure. The project includes a structural equivalency engine that performs deep member-by-member validation of .NET objects using configurable matching rules. It is designed for test-driven and behavior-driven development by generating descriptive failure messages that explain the difference between actual and expected resul
Provides a deep member-by-member validation engine for .NET objects with configurable matching rules.
OpenRewrite is an automated refactoring engine and source-to-source migration framework. It uses a lossless semantic tree parser to represent source code as type-aware trees that preserve original whitespace and formatting, enabling precise and deterministic modifications. The project utilizes a declarative refactoring pipeline where sequences of transformations are defined in YAML to resolve breaking changes and technical debt. It features type-aware pattern matching and cross-language model mapping to apply similar refactoring patterns across different programming languages. The framework
Identifies specific code structures using textual templates and AST bindings to extract parameters for transformations.
Places match on the same line as the method declaration and avoids expanding all arguments for type-only matches.
Comby 是一个命令行实用程序,专为跨多种编程语言的结构化代码搜索和转换而设计。它作为一个代码转换引擎,通过利用语法感知模板来识别和修改源代码模式,确保操作尊重语言边界,如嵌套块、字符串和注释。 该工具的特色在于将各种编程语言映射为统一的结构化表示,从而允许在忽略无关空格和格式的情况下进行一致的模式匹配。它通过执行状态机来执行搜索和替换任务,该状态机验证结构完整性,从而在保留源代码原始缩进和风格约定的同时实现精确修改。 除了简单的搜索和替换外,该工具还通过应用项目范围的语法更新来支持大规模代码库迁移和自动化重构。用户可以通过交互式终端界面验证这些修改,该界面允许在提交到文件系统之前检查和选择性地协调更改。
Matches code patterns by parsing syntax boundaries into abstract templates that ignore irrelevant whitespace.
Z is a pattern matching library for JavaScript that evaluates variables against structural shapes, data types, and literal values to branch program execution conditionally. It functions as a functional programming utility designed to deconstruct arrays and objects into parts during conditional evaluation. The library transforms human-friendly pattern matching syntax into optimized nested conditional statements during compilation or initialization phases, evaluating complex structural conditions and returning matching branch results directly as standard expression values. It inspects runtime d
Evaluates target objects against structural templates to extract inner values and execute corresponding handler functions conditionally.