相关疑难解决方法(0)

穷人为C#"lexer"

我正在尝试用C#编写一个非常简单的解析器.

我需要一个词法分析器 - 让我将正则表达式与标记相关联的东西,所以它读取正则表达式并给我回符号.

看起来我应该能够使用正则表达式进行实际繁重的工作,但我看不出一个简单的方法.首先,Regex似乎只能处理字符串,而不是流(为什么会这样!?!?).

基本上,我想要一个以下接口的实现:

interface ILexer : IDisposable
{
    /// <summary>
    /// Return true if there are more tokens to read
    /// </summary>
    bool HasMoreTokens { get; }
    /// <summary>
    /// The actual contents that matched the token
    /// </summary>
    string TokenContents { get; }
    /// <summary>
    /// The particular token in "tokenDefinitions" that was matched (e.g. "STRING", "NUMBER", "OPEN PARENS", "CLOSE PARENS"
    /// </summary>
    object Token { get; }
    /// <summary>
    /// Move to the next token …
Run Code Online (Sandbox Code Playgroud)

c# regex lexer

32
推荐指数
3
解决办法
2万
查看次数

C++ Vector就像C#中的类

std::vectorC#中类似的C++类是什么?

我想要一个类,它内部保持一个内部数组,并支持在后面插入O(1).

c# c++ list vector

6
推荐指数
1
解决办法
7244
查看次数

具有非托管成员的托管类

我正在使用这个课程:

public ref class x: public System::Windows::Forms::Form
{ 
     private: gcroot<std::string> name;
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

IntelliSense: a member of a managed class cannot be of a non-managed class type
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用char*,但如果我使用了很多char*我将不得不手动做delete[]或者一些堆腐败问题会上升

我已经坚持了两天现在

注意:我必须使用c ++并且必须使用UI C++

c++ clr

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×2

c++ ×2

clr ×1

lexer ×1

list ×1

regex ×1

vector ×1