mirror of
https://github.com/github/codeql.git
synced 2026-07-31 07:22:56 +02:00
Changes from verbatim Ruby baseline (Commit 1) to compilable C++: ParseRegExp.qll: - Remove: private import codeql.ruby.AST as Ast - Remove: private import codeql.Locations - Add: private import semmle.code.cpp.exprs.Literal - Change RegExp base: Ast::StringlikeLiteral -> StringLiteral - Replace getText(): removes getConstantValue() Ruby accessor, uses getValue() (C++ StringLiteral.getValue() returns the string content, analogous to Ruby's getConstantValue().getString()) RegexTreeView.qll: - Remove Ruby-specific imports (codeql.ruby.AST, codeql.Locations, codeql.regex.nfa.NfaUtils) - Add: private import semmle.code.cpp.exprs.Literal - Keep: codeql.util.Numbers (for parseHexInt in RegExpEscape.getUnicode()) - Keep: codeql.regex.RegexTreeView (satisfies RegexTreeViewSig) - Change getParsedRegExp: Ast::RegExpLiteral -> StringLiteral - Simplify hasLocationInfo to use re.getLocation() directly with +1 offset for opening quote (approximate; fixed in commits 8-9) - Replace isExcluded: remove hasFreeSpacingFlag(), use none() - Ruby dialect features preserved unchanged (\\A, \\z, \\G, \\h, etc.); dialect shift is commit 5 Test queries: - parse.ql, regexp.ql: replace codeql.ruby.Regexp with semmle.code.cpp.regex.RegexTreeView - .expected cleared (no test.cpp until commit 3) Verified: both queries compile successfully with codeql query compile.