From 173b277d42d7e9f87d0f990429f7a7a5a40f686a Mon Sep 17 00:00:00 2001 From: xuhong Date: Sat, 14 Sep 2024 17:36:38 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=A7=A3=E5=86=B3=20std::regex=20?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/gdb_expansion.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/gdb_expansion.ts b/src/backend/gdb_expansion.ts index a14c93f..5ab92c5 100644 --- a/src/backend/gdb_expansion.ts +++ b/src/backend/gdb_expansion.ts @@ -1,7 +1,7 @@ import { MINode } from "./mi_parse"; -const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-\>\ \<\:\(\)]*|\[\d+\])\s*=\s*/; -const variableRegex = /^[a-zA-Z_\-\'][a-zA-Z0-9_\-\>\ \\\']*/; +const resultRegex = /^([a-zA-Z_\-][a-zA-Z0-9_\-<> :(),]*|\[\d+\])\s*=\s*/; +const variableRegex = /^[a-zA-Z_\-\'\(][a-zA-Z0-9_\-\>\ \\\'\)\:]*/; const errorRegex = /^\<.+?\>/; const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/; const referenceRegex = /^(0x[0-9a-fA-F]+)/; @@ -278,6 +278,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin const variableMatch = resultRegex.exec(value); if (!variableMatch) { + logger.debug(`parseResult: match fail, value:${JSON.stringify(value)}`); return undefined; } value = value.substring(variableMatch[0].length).trim(); @@ -288,7 +289,7 @@ export function expandValue(variableCreate: Function, value: string, root: strin } let tmpName = name.split(" "); - if(tmpName.length>1 && !name.includes("anonymous union")){ + if(tmpName.length>1 && !name.includes("anonymous union") && !name.includes(',')){ name = tmpName[tmpName.length-1]; } @@ -296,6 +297,8 @@ export function expandValue(variableCreate: Function, value: string, root: strin if (pushToStack){ stack.push(variable); } + logger.debug(`parseResult: will parseValue, name:${name}, value:${JSON.stringify(value)}`); + const val = parseValue(); if (pushToStack){ stack.pop();