-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Baseline HTTP parser + lexer + syntax highlighter. #23
base: main
Are you sure you want to change the base?
Conversation
|
||
REQUEST_TARGET="regexp:\S*" | ||
HTTP_VERSION="regexp:HTTP/\d\.\d"// HTTP-name "/" DIGIT "." DIGIT | ||
// HTTP-name = %s"HTTP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Закомментированные определения стоит подчистить
|
||
////////////////////////////////////////////////////// FIELD LINE ////////////////////////////////////////////////////// | ||
|
||
field_line ::= field_name ":" [OWS] field_value [OWS] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это же Имя заголовка
:Значение
? Дай подходящее имя, пожалуйста, чтобы в дереве было понятно с чем имеем дело
///////////////////////////////////////////////////// MESSAGE BODY ///////////////////////////////////////////////////// | ||
|
||
message_body ::= ( message_line | CRLF )+ | ||
message_line ::= ANY_TOKEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может сделать private, чтобы не выделять в psiTree каждую строку сообщения? Попробовать сделать так, чтобы в дереве просто элемент message_body со всем содержимым.
Ну и я бы переименовал в request_body
http_file ::= requests | ||
|
||
requests ::= request_block* | ||
requests ::= ( request_block | request_definer | comment | CRLF )* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Похоже pin/recoverWhile нужно ещё здесь проработать, т.к. добавление в начале файла <
ломает всё дерево, ни один элемент больше не распознаётся, только отдельные токены.
Примеры с этим (и не только) символом есть здесь и ниже
https://www.jetbrains.com/help/idea/exploring-http-syntax.html#per_request_variables
import com.intellij.psi.tree.IElementType | ||
|
||
class HttpSyntaxHighlighter : SyntaxHighlighterBase() { | ||
companion object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перемести везде companion object в конец класса, пожалуйста
@@ -35,10 +35,9 @@ class HttpRunLineMarkerProvider : RunLineMarkerContributor() { | |||
override fun getInfo(psiElement: PsiElement): Info? { | |||
val leafElement = psiElement as? LeafPsiElement ?: return null | |||
if (leafElement.tokenType !in URL_TYPES) return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!= HttpTypes.REQUEST_TARGET, раз он теперь единственный, не обязательно заводить setOf
No description provided.