|
hoshi-lang dev
Yet another programming language
|
#include <formatter.hpp>

Public Attributes | |
| FormatOption | option |
| std::wostream & | os |
| vec< lexer::Comment > | comments |
Private Member Functions | |
| void | indent () |
| void | newLine () |
| void | write (const yoi::wstr &s) |
| bool | printComments (AST *node) |
| bool | printComments (uint64_t line, uint64_t col) |
| bool | willFit (invocationArguments *node) |
Private Attributes | |
| size_t | indentLevel {0} |
| size_t | currentColumn {0} |
| size_t | lastCommentIdx {0} |
| uint64_t | lastLine {0} |
Definition at line 31 of file formatter.hpp.
| Formatter | ( | std::wostream & | os, |
| FormatOption | option | ||
| ) |
Definition at line 311 of file formatter.cpp.
| Formatter | ( | std::wostream & | os, |
| FormatOption | option, | ||
| vec< lexer::Comment > | comments | ||
| ) |
Definition at line 313 of file formatter.cpp.
| void format | ( | abstractExpr * | node | ) |
Definition at line 563 of file formatter.cpp.
References lexer::token::kind, abstractExpr::lhs, abstractExpr::op, abstractExpr::rhs, and lexer::token::unknown.
| void format | ( | addExpr * | node | ) |
| void format | ( | andExpr * | node | ) |
| void format | ( | basicLiterals * | node | ) |
Definition at line 383 of file formatter.cpp.
References basicLiterals::node.
| void format | ( | bracedInitalizerList * | node | ) |
Definition at line 1138 of file formatter.cpp.
References bracedInitalizerList::exprs.
| void format | ( | breakStmt * | node | ) |
Definition at line 714 of file formatter.cpp.
| void format | ( | catchParam * | node | ) |
Definition at line 970 of file formatter.cpp.
References catchParam::block, catchParam::name, and catchParam::type.
| void format | ( | codeBlock * | node | ) |
Definition at line 630 of file formatter.cpp.
References FormatOption::NewLine, and codeBlock::stmts.
| void format | ( | conceptDefinition * | node | ) |
Definition at line 1227 of file formatter.cpp.
References conceptDefinition::algebraParams, conceptDefinition::conceptBlock, conceptDefinition::name, lexer::token::strVal, and conceptDefinition::typeParams.
| void format | ( | conceptStmt * | node | ) |
Definition at line 1254 of file formatter.cpp.
References conceptStmt::Expression, conceptStmt::ConceptStmtValue::expression, conceptStmt::kind, conceptStmt::SatisfyStmt, conceptStmt::ConceptStmtValue::satisfyStmt, and conceptStmt::value.
| void format | ( | const lexer::token & | token | ) |
Definition at line 367 of file formatter.cpp.
References yoi::formatToken().
Referenced by main(), and Formatter::willFit().


| void format | ( | constructorDecl * | node | ) |
Definition at line 1200 of file formatter.cpp.
References constructorDecl::args, and constructorDecl::tempArgs.
| void format | ( | constructorDef * | node | ) |
Definition at line 1207 of file formatter.cpp.
References constructorDef::args, constructorDef::block, and constructorDef::tempArgs.
| void format | ( | continueStmt * | node | ) |
Definition at line 709 of file formatter.cpp.
| void format | ( | dataStructDefStmt * | node | ) |
Definition at line 848 of file formatter.cpp.
References dataStructDefStmt::id, and dataStructDefStmt::inner.
| void format | ( | decltypeExpr * | node | ) |
Definition at line 1221 of file formatter.cpp.
References decltypeExpr::expr.
| void format | ( | definitionArguments * | node | ) |
Definition at line 457 of file formatter.cpp.
References definitionArguments::spec.
| void format | ( | defTemplateArg * | node | ) |
Definition at line 409 of file formatter.cpp.
References defTemplateArg::spec.
| void format | ( | defTemplateArgSpec * | node | ) |
Definition at line 400 of file formatter.cpp.
References defTemplateArgSpec::id, and defTemplateArgSpec::satisfyCondition.
| void format | ( | dynCastExpression * | node | ) |
Definition at line 994 of file formatter.cpp.
References dynCastExpression::expr, and dynCastExpression::type.
| void format | ( | enumerationDefinition * | node | ) |
Definition at line 1109 of file formatter.cpp.
References enumerationDefinition::name, and enumerationDefinition::values.
| void format | ( | enumerationPair * | node | ) |
Definition at line 1129 of file formatter.cpp.
References yoi::formatToken(), lexer::token::kind, enumerationPair::name, lexer::token::unknown, and enumerationPair::value.

| void format | ( | equalityExpr * | node | ) |
| void format | ( | exclusiveExpr * | node | ) |
| void format | ( | exportDecl * | node | ) |
Definition at line 938 of file formatter.cpp.
References exportDecl::as, exportDecl::attrs, yoi::formatToken(), and exportDecl::from.

| void format | ( | externModuleAccessExpression * | node | ) |
Definition at line 622 of file formatter.cpp.
References externModuleAccessExpression::terms.
| void format | ( | finalizerDecl * | node | ) |
Definition at line 1083 of file formatter.cpp.
| void format | ( | finalizerDef * | node | ) |
Definition at line 1077 of file formatter.cpp.
References finalizerDef::block.
| void format | ( | forEachStmt * | node | ) |
Definition at line 690 of file formatter.cpp.
References forEachStmt::block, forEachStmt::container, and forEachStmt::var.
| void format | ( | forStmt * | node | ) |
Definition at line 678 of file formatter.cpp.
References forStmt::afterStmt, forStmt::block, forStmt::cond, and forStmt::initStmt.
| void format | ( | funcDefStmt * | node | ) |
Definition at line 750 of file formatter.cpp.
References funcDefStmt::args, funcDefStmt::attrs, funcDefStmt::block, yoi::formatToken(), funcDefStmt::id, and funcDefStmt::resultType.

| void format | ( | funcExpr * | node | ) |
Definition at line 1088 of file formatter.cpp.
References funcExpr::args, and funcExpr::name.
| void format | ( | funcTypeSpec * | node | ) |
Definition at line 469 of file formatter.cpp.
References funcTypeSpec::args, and funcTypeSpec::resultType.
| void format | ( | globalStmt * | node | ) |
Definition at line 919 of file formatter.cpp.
References globalStmt::conceptDef, globalStmt::vValue::conceptDefVal, globalStmt::dataStructDefStmt, globalStmt::vValue::dataStructDefStmtVal, globalStmt::enumerationDef, globalStmt::vValue::enumerationDefVal, globalStmt::exportDecl, globalStmt::vValue::exportDeclVal, globalStmt::funcDefStmt, globalStmt::vValue::funcDefStmtVal, globalStmt::implStmt, globalStmt::vValue::implStmtVal, globalStmt::importDecl, globalStmt::vValue::importDeclVal, globalStmt::interfaceDefStmt, globalStmt::vValue::interfaceDefStmtVal, globalStmt::kind, globalStmt::letStmt, globalStmt::vValue::letStmtVal, globalStmt::marco, globalStmt::structDefStmt, globalStmt::vValue::structDefStmtVal, globalStmt::typeAliasStmt, globalStmt::vValue::typeAliasStmtVal, globalStmt::useStmt, globalStmt::vValue::useStmtVal, and globalStmt::value.
| void format | ( | hoshiModule * | node | ) |
Definition at line 1148 of file formatter.cpp.
References globalStmt::importDecl, hoshiModule::stmts, and globalStmt::useStmt.
| void format | ( | identifier * | node | ) |
Definition at line 388 of file formatter.cpp.
References identifier::node.
| void format | ( | identifierWithDefTemplateArg * | node | ) |
Definition at line 520 of file formatter.cpp.
References identifierWithDefTemplateArg::arg, identifierWithDefTemplateArg::hasDefTemplateArg(), and identifierWithDefTemplateArg::id.

| void format | ( | identifierWithTemplateArg * | node | ) |
Definition at line 512 of file formatter.cpp.
References identifierWithTemplateArg::arg, identifierWithTemplateArg::hasTemplateArg(), and identifierWithTemplateArg::id.

| void format | ( | identifierWithTypeSpec * | node | ) |
Definition at line 393 of file formatter.cpp.
References identifierWithTypeSpec::id, and identifierWithTypeSpec::spec.
| void format | ( | ifStmt * | node | ) |
Definition at line 652 of file formatter.cpp.
References ifStmt::ifBlock::block, ifStmt::ifBlock::cond, ifStmt::elifB, ifStmt::elseB, ifStmt::hasElseBlock(), and ifStmt::ifB.

| void format | ( | implInner * | node | ) |
Definition at line 862 of file formatter.cpp.
References implInner::inner, and FormatOption::NewLine.
| void format | ( | implInnerPair * | node | ) |
Definition at line 855 of file formatter.cpp.
References implInnerPair::con, implInnerPair::finalizer, implInnerPair::isConstructor(), implInnerPair::isFinalizer(), implInnerPair::isMethod(), and implInnerPair::met.

| void format | ( | implStmt * | node | ) |
Definition at line 884 of file formatter.cpp.
References implStmt::inner, implStmt::interfaceName, and implStmt::structName.
| void format | ( | importDecl * | node | ) |
Definition at line 952 of file formatter.cpp.
References importDecl::from_path, importDecl::inner, and lexer::token::strVal.
| void format | ( | importInner * | node | ) |
Definition at line 961 of file formatter.cpp.
| void format | ( | inclusiveExpr * | node | ) |
| void format | ( | inCodeBlockStmt * | node | ) |
Definition at line 719 of file formatter.cpp.
References inCodeBlockStmt::breakStmt, inCodeBlockStmt::vValue::breakStmtVal, inCodeBlockStmt::codeBlock, inCodeBlockStmt::vValue::codeBlockVal, inCodeBlockStmt::continueStmt, inCodeBlockStmt::vValue::continueStmtVal, inCodeBlockStmt::forEachStmt, inCodeBlockStmt::vValue::forEachStmtVal, inCodeBlockStmt::forStmt, inCodeBlockStmt::vValue::forStmtVal, inCodeBlockStmt::ifStmt, inCodeBlockStmt::vValue::ifStmtVal, inCodeBlockStmt::kind, inCodeBlockStmt::letStmt, inCodeBlockStmt::vValue::letStmtVal, inCodeBlockStmt::marco, inCodeBlockStmt::vValue::ptr, inCodeBlockStmt::returnStmt, inCodeBlockStmt::vValue::returnStmtVal, inCodeBlockStmt::rExpr, inCodeBlockStmt::vValue::rExprVal, inCodeBlockStmt::throwStmt, inCodeBlockStmt::tryCatchStmt, inCodeBlockStmt::value, inCodeBlockStmt::whileStmt, inCodeBlockStmt::vValue::whileStmtVal, inCodeBlockStmt::yieldStmt, and inCodeBlockStmt::vValue::yieldStmtVal.
| void format | ( | innerMethodDecl * | node | ) |
Definition at line 1171 of file formatter.cpp.
References innerMethodDecl::args, innerMethodDecl::attrs, yoi::formatToken(), innerMethodDecl::name, and innerMethodDecl::resultType.

| void format | ( | innerMethodDef * | node | ) |
Definition at line 1185 of file formatter.cpp.
References innerMethodDef::args, innerMethodDef::attrs, innerMethodDef::block, yoi::formatToken(), innerMethodDef::name, and innerMethodDef::resultType.

| void format | ( | interfaceDefInner * | node | ) |
Definition at line 773 of file formatter.cpp.
References interfaceDefInner::inner, and FormatOption::NewLine.
| void format | ( | interfaceDefInnerPair * | node | ) |
Definition at line 764 of file formatter.cpp.
References interfaceDefInnerPair::isMethod(), interfaceDefInnerPair::method, and interfaceDefInnerPair::var.

| void format | ( | interfaceDefStmt * | node | ) |
Definition at line 795 of file formatter.cpp.
References interfaceDefStmt::id, and interfaceDefStmt::inner.
| void format | ( | invocationArguments * | node | ) |
Definition at line 434 of file formatter.cpp.
References invocationArguments::arg.
| void format | ( | lambdaExpr * | node | ) |
Definition at line 1026 of file formatter.cpp.
References lambdaExpr::args, lambdaExpr::block, lambdaExpr::captures, and lambdaExpr::resultType.
| void format | ( | leftExpr * | node | ) |
Definition at line 582 of file formatter.cpp.
References leftExpr::hasRhs(), leftExpr::lhs, leftExpr::op, and leftExpr::rhs.

| void format | ( | letAssignmentPair * | node | ) |
Definition at line 897 of file formatter.cpp.
References letAssignmentPair::lhs, letAssignmentPair::rhs, and letAssignmentPair::type.
| void format | ( | letAssignmentPairLHS * | node | ) |
Definition at line 1095 of file formatter.cpp.
References yoi::formatToken(), letAssignmentPairLHS::id, letAssignmentPairLHS::identifier, letAssignmentPairLHS::kind, and letAssignmentPairLHS::list.

| void format | ( | letStmt * | node | ) |
Definition at line 910 of file formatter.cpp.
References letStmt::terms.
| void format | ( | logicalAndExpr * | node | ) |
| void format | ( | logicalOrExpr * | node | ) |
| void format | ( | marcoDescriptor * | node | ) |
Definition at line 1059 of file formatter.cpp.
References marcoDescriptor::pairs.
| void format | ( | marcoPair * | node | ) |
Definition at line 1050 of file formatter.cpp.
References marcoPair::constraint, marcoPair::identifier, lexer::token::kind, marcoPair::rhs, lexer::token::strVal, and lexer::token::unknown.
| void format | ( | memberExpr * | node | ) |
Definition at line 536 of file formatter.cpp.
References memberExpr::terms.
| void format | ( | mulExpr * | node | ) |
| void format | ( | newExpression * | node | ) |
Definition at line 1018 of file formatter.cpp.
References newExpression::args, newExpression::length, and newExpression::type.
| void format | ( | primary * | node | ) |
Definition at line 544 of file formatter.cpp.
References primary::basicLiterals, primary::bracedInitalizer, primary::bracedInitalizerList, primary::dynCast, primary::dynCastExpression, primary::expr, primary::func, primary::funcExpr, primary::kind, primary::lambda, primary::lambdaExpr, primary::literals, primary::member, primary::memberExpr, primary::newExpr, primary::newExpression, primary::rExpr, primary::typeId, and primary::typeIdExpression.
| void format | ( | relationalExpr * | node | ) |
| void format | ( | returnStmt * | node | ) |
Definition at line 700 of file formatter.cpp.
References returnStmt::hasValue(), and returnStmt::value.

| void format | ( | rExpr * | node | ) |
Definition at line 617 of file formatter.cpp.
| void format | ( | satisfyClause * | node | ) |
Definition at line 1275 of file formatter.cpp.
References satisfyClause::emaes.
| void format | ( | satisfyStmt * | node | ) |
Definition at line 1270 of file formatter.cpp.
References satisfyStmt::emae.
| void format | ( | shiftExpr * | node | ) |
| void format | ( | structDefInner * | node | ) |
Definition at line 815 of file formatter.cpp.
References structDefInner::inner, and FormatOption::NewLine.
| void format | ( | structDefInnerPair * | node | ) |
Definition at line 802 of file formatter.cpp.
References structDefInnerPair::con, structDefInnerPair::DataField, structDefInnerPair::finalizer, structDefInnerPair::kind, structDefInnerPair::method, structDefInnerPair::modifier, and structDefInnerPair::var.
| void format | ( | structDefStmt * | node | ) |
Definition at line 841 of file formatter.cpp.
References structDefStmt::id, and structDefStmt::inner.
| void format | ( | subscript * | node | ) |
Definition at line 501 of file formatter.cpp.
References subscript::args, subscript::expr, and subscript::isInvocation().

| void format | ( | subscriptExpr * | node | ) |
Definition at line 528 of file formatter.cpp.
References subscriptExpr::id, and subscriptExpr::subscriptVal.
| void format | ( | templateArg * | node | ) |
Definition at line 424 of file formatter.cpp.
References templateArg::spec.
| void format | ( | templateArgSpec * | node | ) |
Definition at line 419 of file formatter.cpp.
References templateArgSpec::spec.
| void format | ( | throwStmt * | node | ) |
Definition at line 964 of file formatter.cpp.
References throwStmt::expr.
| void format | ( | tryCatchStmt * | node | ) |
Definition at line 980 of file formatter.cpp.
References tryCatchStmt::catchParams, tryCatchStmt::finallyBlock, and tryCatchStmt::tryBlock.
| void format | ( | typeAliasStmt * | node | ) |
Definition at line 1069 of file formatter.cpp.
References typeAliasStmt::lhs, and typeAliasStmt::rhs.
| void format | ( | typeIdExpression * | node | ) |
Definition at line 1003 of file formatter.cpp.
References typeIdExpression::expr, and typeIdExpression::type.
| void format | ( | typeSpec * | node | ) |
Definition at line 477 of file formatter.cpp.
References typeSpec::arraySubscript, typeSpec::DecltypeExpr, typeSpec::decltypeExpression, typeSpec::Elipsis, typeSpec::elipsis, typeSpec::Func, typeSpec::func, typeSpec::isNull, typeSpec::kind, typeSpec::Member, typeSpec::member, and yoi::string2wstring().

| void format | ( | uniqueExpr * | node | ) |
Definition at line 574 of file formatter.cpp.
References lexer::token::kind, uniqueExpr::lhs, uniqueExpr::op, and lexer::token::unknown.
| void format | ( | unnamedDefinitionArguments * | node | ) |
Definition at line 1040 of file formatter.cpp.
References unnamedDefinitionArguments::types.
| void format | ( | useStmt * | node | ) |
Definition at line 741 of file formatter.cpp.
References yoi::escapeString(), useStmt::name, useStmt::path, and lexer::token::strVal.

| void format | ( | whileStmt * | node | ) |
Definition at line 670 of file formatter.cpp.
References whileStmt::block, and whileStmt::cond.
| void format | ( | yieldStmt * | node | ) |
Definition at line 1215 of file formatter.cpp.
References yieldStmt::expr.
|
private |
Definition at line 316 of file formatter.cpp.
References FormatOption::Space.
|
private |
Definition at line 324 of file formatter.cpp.
|
private |
Definition at line 335 of file formatter.cpp.
References AST::getColumn(), and AST::getLine().

|
private |
Definition at line 340 of file formatter.cpp.
References yoi::trim().

|
private |
Definition at line 373 of file formatter.cpp.
References Formatter::format(), and FormatOption::maxWidth.

|
private |
Definition at line 330 of file formatter.cpp.
| vec<lexer::Comment> comments |
Definition at line 35 of file formatter.hpp.
|
private |
Definition at line 43 of file formatter.hpp.
|
private |
Definition at line 42 of file formatter.hpp.
|
private |
Definition at line 44 of file formatter.hpp.
|
private |
Definition at line 45 of file formatter.hpp.
| FormatOption option |
Definition at line 33 of file formatter.hpp.
| std::wostream& os |
Definition at line 34 of file formatter.hpp.