我有一个最终用户需要编辑的大型脚本,因此它需要一些多余的注释。我为我的文件使用类似于此的布局
//********************
//
// FileName
// This script contains:
// - Function X - does something
// - Function Y - does something else
//
//********************
//********************
// Function X
// does something (<< I'd only like to enter this part once)
//********************
// Code here...
//********************
// Function Y
// does something else
//********************
// Code here...
我想创建一个简单的解析器,将函数摘要复制/粘贴到文件头。我知道有几种工具可以帮助实现这一点,比如 ANTLR 甚至 RegEx,但最好的方法是什么?