Files
sdk/pkg/analysis_server/tool/lsp_spec/markdown.dart
T
Konstantin Shcheglov 4757152a0b Migrate a few random analysis_server libraries.
Mostly no-ops.

Change-Id: Ia538aed657576203ec104bd849862bcc87025bef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194006
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-04-05 16:06:36 +00:00

26 lines
885 B
Dart

// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
final _methodNamesPattern = RegExp(
r'''_(?:Notification|Request):?_:?(?:\r?\n)+\* method: ['`](.*?)[`'],?\r?\n''',
multiLine: true);
final _typeScriptBlockPattern =
RegExp(r'\B```typescript([\S\s]*?)\n\s*```', multiLine: true);
List<String> extractMethodNames(String spec) {
return _methodNamesPattern
.allMatches(spec)
.map((m) => m.group(1)!.trim())
.toList();
}
/// Extracts fenced code blocks that are explicitly marked as TypeScript from a
/// markdown document.
List<String> extractTypeScriptBlocks(String text) {
return _typeScriptBlockPattern
.allMatches(text)
.map((m) => m.group(1)!.trim())
.toList();
}