|
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 314 of file formatter.cpp.
| Formatter | ( | std::wostream & | os, |
| FormatOption | option, | ||
| vec< lexer::Comment > | comments | ||
| ) |
Definition at line 316 of file formatter.cpp.
| void format | ( | abstractExpr * | node | ) |
Definition at line 566 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 386 of file formatter.cpp.
References basicLiterals::node.
| void format | ( | bracedInitalizerList * | node | ) |
Definition at line 1146 of file formatter.cpp.
References bracedInitalizerList::exprs.
| void format | ( | breakStmt * | node | ) |
Definition at line 717 of file formatter.cpp.
| void format | ( | catchParam * | node | ) |
Definition at line 978 of file formatter.cpp.
References catchParam::block, catchParam::name, and catchParam::type.
| void format | ( | codeBlock * | node | ) |
Definition at line 633 of file formatter.cpp.
References FormatOption::NewLine, and codeBlock::stmts.
| void format | ( | conceptDefinition * | node | ) |
Definition at line 1235 of file formatter.cpp.
References conceptDefinition::algebraParams, conceptDefinition::conceptBlock, conceptDefinition::name, lexer::token::strVal, and conceptDefinition::typeParams.
| void format | ( | conceptStmt * | node | ) |
Definition at line 1262 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 370 of file formatter.cpp.
References yoi::formatToken().
Referenced by main(), and Formatter::willFit().


| void format | ( | constructorDecl * | node | ) |
Definition at line 1208 of file formatter.cpp.
References constructorDecl::args, and constructorDecl::tempArgs.
| void format | ( | constructorDef * | node | ) |
Definition at line 1215 of file formatter.cpp.
References constructorDef::args, constructorDef::block, and constructorDef::tempArgs.
| void format | ( | continueStmt * | node | ) |
Definition at line 712 of file formatter.cpp.
| void format | ( | dataStructDefStmt * | node | ) |
Definition at line 852 of file formatter.cpp.
References dataStructDefStmt::id, and dataStructDefStmt::inner.
| void format | ( | decltypeExpr * | node | ) |
Definition at line 1229 of file formatter.cpp.
References decltypeExpr::expr.
| void format | ( | definitionArguments * | node | ) |
Definition at line 460 of file formatter.cpp.
References definitionArguments::spec.
| void format | ( | defTemplateArg * | node | ) |
Definition at line 412 of file formatter.cpp.
References defTemplateArg::spec.
| void format | ( | defTemplateArgSpec * | node | ) |
Definition at line 403 of file formatter.cpp.
References defTemplateArgSpec::id, and defTemplateArgSpec::satisfyCondition.
| void format | ( | dynCastExpression * | node | ) |
Definition at line 1002 of file formatter.cpp.
References dynCastExpression::expr, and dynCastExpression::type.
| void format | ( | enumerationDefinition * | node | ) |
Definition at line 1117 of file formatter.cpp.
References enumerationDefinition::name, and enumerationDefinition::values.
| void format | ( | enumerationPair * | node | ) |
Definition at line 1137 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 946 of file formatter.cpp.
References exportDecl::as, exportDecl::attrs, yoi::formatToken(), and exportDecl::from.

| void format | ( | externModuleAccessExpression * | node | ) |
Definition at line 625 of file formatter.cpp.
References externModuleAccessExpression::terms.
| void format | ( | finalizerDecl * | node | ) |
Definition at line 1091 of file formatter.cpp.
| void format | ( | finalizerDef * | node | ) |
Definition at line 1085 of file formatter.cpp.
References finalizerDef::block.
| void format | ( | forEachStmt * | node | ) |
Definition at line 693 of file formatter.cpp.
References forEachStmt::block, forEachStmt::container, and forEachStmt::var.
| void format | ( | forStmt * | node | ) |
Definition at line 681 of file formatter.cpp.
References forStmt::afterStmt, forStmt::block, forStmt::cond, and forStmt::initStmt.
| void format | ( | funcDefStmt * | node | ) |
Definition at line 753 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 1096 of file formatter.cpp.
References funcExpr::args, and funcExpr::name.
| void format | ( | funcTypeSpec * | node | ) |
Definition at line 472 of file formatter.cpp.
References funcTypeSpec::args, and funcTypeSpec::resultType.
| void format | ( | globalStmt * | node | ) |
Definition at line 927 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 1156 of file formatter.cpp.
References globalStmt::importDecl, hoshiModule::stmts, and globalStmt::useStmt.
| void format | ( | identifier * | node | ) |
Definition at line 391 of file formatter.cpp.
References identifier::node.
| void format | ( | identifierWithDefTemplateArg * | node | ) |
Definition at line 523 of file formatter.cpp.
References identifierWithDefTemplateArg::arg, identifierWithDefTemplateArg::hasDefTemplateArg(), and identifierWithDefTemplateArg::id.

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

| void format | ( | identifierWithTypeSpec * | node | ) |
Definition at line 396 of file formatter.cpp.
References identifierWithTypeSpec::id, and identifierWithTypeSpec::spec.
| void format | ( | ifStmt * | node | ) |
Definition at line 655 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 866 of file formatter.cpp.
References implInner::inner, and FormatOption::NewLine.
| void format | ( | implInnerPair * | node | ) |
Definition at line 859 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 892 of file formatter.cpp.
References implStmt::inner, implStmt::interfaceName, and implStmt::structName.
| void format | ( | importDecl * | node | ) |
Definition at line 960 of file formatter.cpp.
References importDecl::from_path, importDecl::inner, and lexer::token::strVal.
| void format | ( | importInner * | node | ) |
Definition at line 969 of file formatter.cpp.
| void format | ( | inclusiveExpr * | node | ) |
| void format | ( | inCodeBlockStmt * | node | ) |
Definition at line 722 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 1179 of file formatter.cpp.
References innerMethodDecl::args, innerMethodDecl::attrs, yoi::formatToken(), innerMethodDecl::name, and innerMethodDecl::resultType.

| void format | ( | innerMethodDef * | node | ) |
Definition at line 1193 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 776 of file formatter.cpp.
References interfaceDefInner::inner, and FormatOption::NewLine.
| void format | ( | interfaceDefInnerPair * | node | ) |
Definition at line 767 of file formatter.cpp.
References interfaceDefInnerPair::isMethod(), interfaceDefInnerPair::method, and interfaceDefInnerPair::var.

| void format | ( | interfaceDefStmt * | node | ) |
Definition at line 798 of file formatter.cpp.
References interfaceDefStmt::id, and interfaceDefStmt::inner.
| void format | ( | invocationArguments * | node | ) |
Definition at line 437 of file formatter.cpp.
References invocationArguments::arg.
| void format | ( | lambdaCapture * | node | ) |
Definition at line 1294 of file formatter.cpp.
References lambdaCapture::attr, structDefInnerPair::DataField, lambdaCapture::identifier, and structDefInnerPair::Weak.
| void format | ( | lambdaExpr * | node | ) |
Definition at line 1034 of file formatter.cpp.
References lambdaExpr::args, lambdaExpr::block, lambdaExpr::captures, and lambdaExpr::resultType.
| void format | ( | leftExpr * | node | ) |
Definition at line 585 of file formatter.cpp.
References leftExpr::hasRhs(), leftExpr::lhs, leftExpr::op, and leftExpr::rhs.

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

| void format | ( | letStmt * | node | ) |
Definition at line 918 of file formatter.cpp.
References letStmt::terms.
| void format | ( | logicalAndExpr * | node | ) |
| void format | ( | logicalOrExpr * | node | ) |
| void format | ( | marcoDescriptor * | node | ) |
Definition at line 1067 of file formatter.cpp.
References marcoDescriptor::pairs.
| void format | ( | marcoPair * | node | ) |
Definition at line 1058 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 539 of file formatter.cpp.
References memberExpr::terms.
| void format | ( | mulExpr * | node | ) |
| void format | ( | newExpression * | node | ) |
Definition at line 1026 of file formatter.cpp.
References newExpression::args, newExpression::length, and newExpression::type.
| void format | ( | primary * | node | ) |
Definition at line 547 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 703 of file formatter.cpp.
References returnStmt::hasValue(), and returnStmt::value.

| void format | ( | rExpr * | node | ) |
Definition at line 620 of file formatter.cpp.
| void format | ( | satisfyClause * | node | ) |
Definition at line 1283 of file formatter.cpp.
References satisfyClause::emaes.
| void format | ( | satisfyStmt * | node | ) |
Definition at line 1278 of file formatter.cpp.
References satisfyStmt::emae.
| void format | ( | shiftExpr * | node | ) |
| void format | ( | structDefInner * | node | ) |
Definition at line 819 of file formatter.cpp.
References structDefInner::inner, and FormatOption::NewLine.
| void format | ( | structDefInnerPair * | node | ) |
Definition at line 805 of file formatter.cpp.
References structDefInnerPair::con, structDefInnerPair::DataField, structDefInnerPair::finalizer, structDefInnerPair::kind, structDefInnerPair::method, structDefInnerPair::modifier, structDefInnerPair::var, and structDefInnerPair::Weak.
| void format | ( | structDefStmt * | node | ) |
Definition at line 845 of file formatter.cpp.
References structDefStmt::id, and structDefStmt::inner.
| void format | ( | subscript * | node | ) |
Definition at line 504 of file formatter.cpp.
References subscript::args, subscript::expr, and subscript::isInvocation().

| void format | ( | subscriptExpr * | node | ) |
Definition at line 531 of file formatter.cpp.
References subscriptExpr::id, and subscriptExpr::subscriptVal.
| void format | ( | templateArg * | node | ) |
Definition at line 427 of file formatter.cpp.
References templateArg::spec.
| void format | ( | templateArgSpec * | node | ) |
Definition at line 422 of file formatter.cpp.
References templateArgSpec::spec.
| void format | ( | throwStmt * | node | ) |
Definition at line 972 of file formatter.cpp.
References throwStmt::expr.
| void format | ( | tryCatchStmt * | node | ) |
Definition at line 988 of file formatter.cpp.
References tryCatchStmt::catchParams, tryCatchStmt::finallyBlock, and tryCatchStmt::tryBlock.
| void format | ( | typeAliasStmt * | node | ) |
Definition at line 1077 of file formatter.cpp.
References typeAliasStmt::lhs, and typeAliasStmt::rhs.
| void format | ( | typeIdExpression * | node | ) |
Definition at line 1011 of file formatter.cpp.
References typeIdExpression::expr, and typeIdExpression::type.
| void format | ( | typeSpec * | node | ) |
Definition at line 480 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 577 of file formatter.cpp.
References lexer::token::kind, uniqueExpr::lhs, uniqueExpr::op, and lexer::token::unknown.
| void format | ( | unnamedDefinitionArguments * | node | ) |
Definition at line 1048 of file formatter.cpp.
References unnamedDefinitionArguments::types.
| void format | ( | useStmt * | node | ) |
Definition at line 744 of file formatter.cpp.
References yoi::escapeString(), useStmt::name, useStmt::path, and lexer::token::strVal.

| void format | ( | whileStmt * | node | ) |
Definition at line 673 of file formatter.cpp.
References whileStmt::block, and whileStmt::cond.
| void format | ( | yieldStmt * | node | ) |
Definition at line 1223 of file formatter.cpp.
References yieldStmt::expr.
|
private |
Definition at line 319 of file formatter.cpp.
References FormatOption::Space.
|
private |
Definition at line 327 of file formatter.cpp.
|
private |
Definition at line 338 of file formatter.cpp.
References AST::getColumn(), and AST::getLine().

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

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

|
private |
Definition at line 333 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.