// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_NAVIGATION_PARSER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_NAVIGATION_PARSER_H_

#include <optional>

#include "third_party/blink/renderer/core/css/parser/conditional_parser.h"
#include "third_party/blink/renderer/core/css/parser/css_parser_token.h"
#include "third_party/blink/renderer/core/route_matching/navigation_preposition.h"

namespace blink {

class CSSParserTokenStream;
class NavigationLocation;
class NavigationQuery;
class NavigationTestExpression;

class NavigationParser : public ConditionalParser {
 public:
  // https://drafts.csswg.org/css-navigation-1/#typedef-navigation-test
  //
  // <navigation-test> = <navigation-location-test> | <navigation-type-test> |
  // <navigation-phase-test>
  static NavigationTestExpression* ParseNavigationTest(CSSParserTokenStream&);

  static NavigationQuery* ParseQuery(CSSParserTokenStream&);
  static NavigationLocation* ParseLocation(CSSParserTokenStream&);
  static std::optional<NavigationPreposition> ParsePrepositionIdent(
      CSSParserToken);

  const ConditionalExpNode* ConsumeLeaf(CSSParserTokenStream&) final;
  const ConditionalExpNode* ConsumeFunction(CSSParserTokenStream&) final;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PARSER_NAVIGATION_PARSER_H_
