mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 08:40:10 +01:00
Move handling of mismatched brackets out of the main lexing loop into a separate pass that is only run if there are mismatched brackets This is done in preparation for using both lookahead and lookbehind to work out how to match brackets, and to get this code far away from the hot lexing loop. Fix bracket insertion location to be immediately after the token that we're inserting the bracket after, rather than potentially at the end of a comment. When there are open brackets at the end of the file, say that there are open brackets, not that there's a closing bracket without a matching opening bracket.
19 lines
692 B
Plaintext
19 lines
692 B
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// ARGS: compile --phase=lex --stream-errors %s
|
|
//
|
|
// AUTOUPDATE
|
|
|
|
fn run(String program) {
|
|
return True;
|
|
|
|
// CHECK:STDERR: fail_errors_streamed.carbon:[[@LINE+6]]:10: ERROR: Invalid digit 'a' in decimal numeric literal.
|
|
// CHECK:STDERR: var x = 3a;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR: fail_errors_streamed.carbon:[[@LINE-6]]:24: ERROR: Opening symbol without a corresponding closing symbol.
|
|
// CHECK:STDERR: fn run(String program) {
|
|
// CHECK:STDERR: ^
|
|
var x = 3a;
|